[Pkg-haskell-maintainers] Bug#678056: SIGALRM problem prevents using FFI to interface with FreeBSD kqueue()
Joey Hess
joeyh at debian.org
Mon Jun 18 21:28:41 UTC 2012
Package: ghc
Version: 7.4.1-4
Severity: normal
The attached tarball can be extracted on Debian kFreeBSD (or possibly
a real BSD system) and this bug demonstrated as follows:
(sid-kfreebsd-i386-dchroot)joeyh at fischer:~/git-annex/testcase$ make Utility/libkqueue.o
(sid-kfreebsd-i386-dchroot)joeyh at fischer:~/git-annex/testcase$ ghc --make foo Utility/libkqueue.o
(sid-kfreebsd-i386-dchroot)joeyh at fischer:~/git-annex/testcase$ gcc Utility/libkqueue.c -DSTANDALONE
(sid-kfreebsd-i386-dchroot)joeyh at fischer:~/git-annex/testcase$ ./foo &
[4] 23101
"detected a change in Nothing"
(sid-kfreebsd-i386-dchroot)joeyh at fischer:~/git-annex/testcase$ ./a.out &
[5] 23103
(sid-kfreebsd-i386-dchroot)joeyh at fischer:~/git-annex/testcase$ touch test
change: 3
Utility/libkqueue.c is a small C library using the kqueue() interface
to tell when a directory's contents have changed. It can be built standalone
to the a.out shown above, which then behaves as shown, waiting for a change
to the current directory and printing something.
foo.hs uses this library, and should be making the same calls
to functions in it, using the FFI. However, as shown above, it fails
to wait for any changes, returning an error condition immediately.
Here's the relevant ktrace for a.out:
24323 a.out CALL open(0x8048807,0<><invalid>0,<unused>0)
24323 a.out NAMI "."
24323 a.out RET open 3
24323 a.out CALL kqueue
24323 a.out RET kqueue 4
24323 a.out CALL kevent(0x4,0xbfbfe638,0x1,0xbfbfe678,0x1,0xbfbfe6c4)
24323 a.out GIO fd 4 wrote 20 bytes
0x0000 0300 0000 fcff 2500 0200 0000 0000 0000 |......%.........|
0x0010 0000 0000 |....|
24323 a.out GIO fd 4 read 0 bytes
""
24323 a.out RET kevent 0
24323 a.out CALL kevent(0x4,0xbfbfe658,0,0xbfbfe688,0x1,0)
24323 a.out GIO fd 4 wrote 0 bytes
""
24323 a.out GIO fd 4 read 20 bytes
0x0000 0300 0000 fcff 2000 0200 0000 0000 0000 |...... .........|
0x0010 0000 0000 |....|
24323 a.out RET kevent 1
And for foo:
25140 foo CALL open(0x286fc040,0<><invalid>0,<unused>0)
25140 foo NAMI "."
25140 foo RET open 3
25140 foo CALL kqueue
25140 foo RET kqueue 4
25140 foo CALL kevent(0x4,0xbfbfc598,0x1,0xbfbfc5d8,0x1,0xbfbfc624)
25140 foo GIO fd 4 wrote 20 bytes
0x0000 0300 0000 fcff 2500 0200 0000 0000 0000 |......%.........|
0x0010 0000 0000 |....|
25140 foo GIO fd 4 read 0 bytes
""
25140 foo RET kevent 0
25140 foo CALL kevent(0x4,0xbfbfc5b8,0,0xbfbfc5e8,0x1,0)
25140 foo GIO fd 4 wrote 0 bytes
""
25140 foo RET kevent -1 errno 4 Interrupted system call
25140 foo PSIG SIGALRM caught handler=0x285147b0 mask=0x80000000 code=0x0
25140 foo CALL sigreturn(0xbfbfc290)
25140 foo RET sigreturn JUSTRETURN
Apparently something in the GHC runtime is causing this SIGALARM, which
interrupts the kevent() call, rather than letting it wait for an event.
Other than that, the straces *seem* the same to me, leading me to believe
I've not gotten something wrong in my haskell code.
I wonder if this bug also exists on regular FreeBSD?
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: kfreebsd-i386
Kernel: GNU/kFreeBSD fischer 8.1-1-686-smp #0 Fri Oct 21 21:08:56 UTC 2011 i686 i386 QEMU Virtual CPU version 0.12.5 GNU/kFreeBSD
--
see shy jo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testcase.tar.gz
Type: application/octet-stream
Size: 2209 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-haskell-maintainers/attachments/20120618/969273bc/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-haskell-maintainers/attachments/20120618/969273bc/attachment.pgp>
More information about the Pkg-haskell-maintainers
mailing list