[Haskell-cafe] fcntl locks, executeFile and threaded runtime
diego souza
dsouza at c0d3.xxx
Fri Oct 25 23:49:37 UTC 2013
Yeah, it was my first thought too, but I didn't see anything like this
in the strace output.
What I do see, though, are two additional forks when using -threaded
that seems that die early. This could very well explain why I'm
loosing the lock.
But then, why this only happens using executeFile?
Thanks!
~dsouza
ghc -rtsopts --make test.hs; strace -f -e trace=fork,fcntl,dup,dup2,close -e signal=\!SIGVTALRM ./test >/dev/null
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
Process 11591 attached
[pid 11591] fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 11591] close(4) = 0
[pid 11591] close(4) = 0
[pid 11591] close(4) = 0
[pid 11590] fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = -1 EAGAIN (Resource temporarily unavailable)
test: setLock: resource exhausted (Resource temporarily unavailable)
[pid 11590] +++ exited with 1 +++
close(1) = 0
close(2) = 0
+++ exited with 0 +++
ghc -threaded -rtsopts --make test.hs; strace -f -e trace=fork,fcntl,dup,dup2,close -e signal=\!SIGVTALRM ./tes[23/96461]
ll
Linking test ...
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
close(3) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(5, F_GETFL) = 0x1 (flags O_WRONLY)
fcntl(5, F_SETFL, O_WRONLY|O_NONBLOCK) = 0
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
Process 11610 attached
[pid 11609] fcntl(6, F_GETFL) = 0x2 (flags O_RDWR)
[pid 11609] fcntl(6, F_SETFL, O_RDWR|O_NONBLOCK) = 0
[pid 11609] fcntl(6, F_SETFD, FD_CLOEXEC) = 0
Process 11611 attached
Process 11612 attached
[pid 11612] close(3) = 0
[pid 11612] close(4) = 0
[pid 11612] close(5) = 0
[pid 11612] close(6) = 0
[pid 11612] fcntl(3, F_SETFD, FD_CLOEXEC) = 0
[pid 11612] fcntl(5, F_GETFL) = 0x1 (flags O_WRONLY)
[pid 11612] fcntl(5, F_SETFL, O_WRONLY|O_NONBLOCK) = 0
[pid 11612] fcntl(4, F_SETFD, FD_CLOEXEC) = 0
[pid 11612] fcntl(5, F_SETFD, FD_CLOEXEC) = 0
Process 11613 attached
[pid 11612] fcntl(6, F_GETFL) = 0x2 (flags O_RDWR)
[pid 11612] fcntl(6, F_SETFL, O_RDWR|O_NONBLOCK) = 0
[pid 11612] fcntl(6, F_SETFD, FD_CLOEXEC) = 0
[pid 11612] fcntl(7, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 11613] +++ exited with 0 +++
[pid 11612] close(3) = 0
[pid 11612] close(3) = 0
[pid 11612] close(3) = 0
[pid 11609] fcntl(7, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
[pid 11612] close(1) = 0
[pid 11612] close(2) = 0
[pid 11612] +++ exited with 0 +++
[pid 11609] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=11612, si_status=0, si_utime=0, si_stime=0} ---
[pid 11610] close(3) = 0
[pid 11610] close(4) = 0
[pid 11610] close(5) = 0
[pid 11610] close(6) = 0
[pid 11610] +++ exited with 0 +++
[pid 11611] +++ exited with 0 +++
+++ exited with 0 +++
At Fri, 25 Oct 2013 13:28:23 -0400,
Brandon Allbery wrote:
>
> [1 <multipart/alternative (7bit)>]
> [1.1 <text/plain; UTF-8 (7bit)>]
>
> [1.2 <text/html; UTF-8 (quoted-printable)>]
> On Fri, Oct 25, 2013 at 1:20 PM, Donn Cave <donn at avvanta.com> wrote:
>
> >
> > On Fri, Oct 25, 2013 at 11:52 AM, Donn Cave <donn at avvanta.com> wrote:
> >
> >> But I don't see how executeFile could
> >> make any difference, in that scenario.
> >
> > Look for fcntl(fd, FD_CLOEXEC, 1) calls?
>
> Oh, that would be heinous!
>
> It would be because I got that completely wrong. fcntl(fd, F_SETFD, FD_CLOEXEC). sigh.
>
> --
> brandon s allbery kf8nh sine nomine associates
> allbery.b at gmail.com ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
>
>
> [2 <text/plain; us-ascii (7bit)>]
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list