[squeak-dev] Multithreading and service initialization

Norbert Hartl norbert at hartl.name
Fri May 2 09:34:07 UTC 2008


Hi,

my tests of the new rST Code gave me 6 out of 14 tests
failing. It took me a while to narrow the problem. 
I built a vm which prints debug messages of the Socket-
Plugin. I grabbed a piece of the log to show what I think
went wrong:

    5031        0 socketStatus(7) -> 0
    5031        0 socketStatus(7) -> 0
    5031        0 connectTo(7)
    5031        0 connect() => -1
    5033        2 connectHandler(7, 0x80ab158, 4)
    5033        0 connectHandler: error 111 (Connection refused)
    5033        0 notify 7 conn
    5033        0 socketStatus(7) -> 0
    5038        5 socketStatus(7) -> 0
    5040        2 create(8) -> 80ab268
    5040        0 socketStatus(8) -> 0
    5040        0 socketStatus(8) -> 0
    5040        0 listenOnPortBacklogSize(8, 10)
    5040        0 socketStatus(8) -> 1
 
The problem appears that the client connects before the
listen socket is bound (and accepting). The listen socket
is created in a new thread (ApplicationService>>start).
But the exection seems to be delay after the client connect
call. This error is raised every time I tried it.

What would be the best method to have multithreading and aio
(I think the problems can be here, too) but to ensure a certain
state is reached before continuing a dependent part of the 
application? I tried to fix it by delaying the client and this
works but this not a problem solution.

Norbert





More information about the Squeak-dev mailing list