[gambit-list] Threads blocking and IO
François Magnan
francois.magnan at licef.ca
Thu Jan 31 10:49:25 EST 2008
Hi,
Thank you all for your answers. The process I start with open-process
is a java application that uses it's standard input and standard
output for interacting with java classes through reflection. It is
some kind of bridge between the Gambit world and the Java world. The
bug appears on both Windows (MIngW) and MacOSX (Leopard).
Can IO with external processes (through open-process) block all threads?
I will try to get the latest patches if it fixes the bug. I will also
try wo put timeouts on all IO operations to isolate the faulty one.
I also have a (separate?) problem strictly on WinXP where the open-tcp-
server implementation seems to miss some client connections when there
are too much concurrent connections. I have a web services server
implemented in Gambit and the client browers make some Ajax calls when
the page initially loads. One of them is consistently never received
by the server. When there is let load on the server, the same request
is always received and answered properly.
I tested this with many different clients, some requests are just
dropped by the server.
Could this be related to the WaitForMultipleObjects() that Jeff Read
was mentioning in his answer to my post?
Thanks,
Francois Magnan
On 29-Jan-08, at 11:47 PM, Marc Feeley wrote:
> On 29-Jan-08, at 3:27 PM, François Magnan wrote:
>
>> Hello,
>>
>> I am experiencing a strange bug in my code that would be long to
>> explain. To resume the context, I have many threads running in
>> parallel, some open-process IO, some tcp-server IO and some termite
>> processes. At some point all the threads become blocked
>> indefinitely and the program sleeps forever.
>
> Are these problems occurring on Mac OS X? Could you describe what
> processes you start with open-process? I'm asking because I
> recently fixed a bug in open-process.
>
>> I stumbled on the following paragraph in the threads section of
>> the Gambit doc:
>>
>> ``A thread is blocked if it is waiting for a mutex to become
>> unlocked, an I/O operation to become possible, the end of a “sleep”
>> period, etc. ''
>>
>>
>> I think this may lead me to a solution to my bug but I don't
>> clearly understand the statement. Could there be an IO operation
>> that blocks all my threads?
>> Any help would be greatly appreciated.
>
> You have to beware of C functions that are called from the Scheme
> world. If the C function performs an I/O operation, or a "sleep",
> or a "wait" on a process, or acquire a mutex, and the operation
> blocks then the Scheme thread scheduler will never get a chance to
> schedule another Scheme thread. Some Scheme functions which rely on
> C library functions that can block, such as host-info, also have the
> same issue.
>
> Marc
>
More information about the Gambit-list
mailing list