The value NIL is not of type SB-IMPL::BUFFER.

Bug #321446 reported by Attila Lendvai on 2009-01-26
2
Affects Status Importance Assigned to Milestone
SBCL
Medium
Unassigned

Bug Description

once i get this error, it remains forever. seems like some lethal sideffect happens... after this the web server is unable to serve anything with the same error.

our new codebase is not affected by this (uses iolib), so if you can't quickly find something suspicious and as i can't give a test-case, feel free to close it...

might be due to multi-core threading.

the error comes from here:

014: (SB-IMPL::WRITE-OUTPUT-FROM-QUEUE #<SB-SYS:FD-STREAM for \"a socket\" {100A1CC831}>)
015: (SB-IMPL::SUB-SERVE-EVENT NIL NIL NIL)
016: (SB-SYS:WAIT-UNTIL-FD-USABLE 5 :INPUT NIL)
017: (SB-IMPL::REFILL-INPUT-BUFFER #<SB-SYS:FD-STREAM for \"a socket\" {1009629B61}>)
018: (SB-IMPL::INPUT-UNSIGNED-8BIT-BYTE #<SB-SYS:FD-STREAM for \"a socket\" {1009629B61}> T #<SB-SYS:FD-STREAM for \"a socket\" {1009629B61}>)
019: ((LABELS IT.BESE.UCW::READ-NEXT-CHAR))

Linux node3 2.6.20-17-generic #2 SMP Wed Aug 20 15:14:36 UTC 2008 x86_64 GNU/Linux

SBCL 1.0.12.2

hth,

- attila

Nikodemus Siivola (nikodemus) wrote :

I don't have a test case as of yet either, but if multiple threads end up calling WRITE-OUTPUT-FROM-QUEUE for the same at roughly the same time, the queue may be empty by the time the second one tries to pull out a buffer -- which is what I think is going on here.

Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
Gábor Melis (melisgl) wrote :

There is certainly a race here between threads, but I cannot see how the error could persist due to that. However, there is a race in %queue-and-replace-output-buffer adding and setting an fd-handler: it's possible for two threads to add one fd-handler each and only one will be remembered in fd-stream-handler.

There are other doubtless numerous other issues related to fd-streams and how it hooks into serve-event, I've found a few while auditing it. While individual bugs do not seem difficult to fix, I'm still trying to assess whether its design is sound.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers