Program crash: GC destroys an object unexpectedly

eugene dee0xeed at gmail.com
Tue Sep 14 14:14:59 UTC 2021


On Tuesday, 14 September 2021 at 12:52:44 UTC, Steven 
Schveighoffer wrote:
> But I agree that a superficial reading of your code seems like 
> it ought to not be collected, and that problem is also worth 
> figuring out. I have high confidence that it's probably not a 
> design flaw in the GC, but rather some misunderstanding of 
> GC-allocated lifetimes in your code. But that doesn't mean it's 
> not actually a bug somewhere in D.

run the server (do not run client):

     'LISTENER @ INIT' got 'M0' from 'SELF'
     'LISTENER' registered 104 (esrc.TCPListener)
     'LISTENER' enabled 104 (esrc.TCPListener)
     'LISTENER' enabled 105 (esrc.Signal)
     'LISTENER' enabled 106 (esrc.Signal)

wait > 6 seconds
press ^C

observe

     ___!!!___edsm.StageMachine.~this(): WORKER-95 destroyed...
     ___!!!___edsm.StageMachine.~this(): WORKER-96 destroyed...
     ___!!!___edsm.StageMachine.~this(): LISTENER destroyed...

run client (do not run the server)

observe

     'CLIENT-9 @ CONN' got 'M2' from 'TX-1'
     CLIENT-9:client.EchoClient.clientConnM2() : connection to 
'localhost:1111' failed error111)
     CLIENT-9:client.EchoClient.clientConnM2() : connection to 
'localhost:1111' failed(Connection refused)

press ^C

observe

     ___!!!___edsm.StageMachine.~this(): STOPPER destroyed...

run server again
run client like this:

     ./echo-client | grep owner

wait >6.seconds

see

    !!! esrc.EventSource.~this() : esrc.Signal (owner STOPPER, fd 
= 24) this @ 0x7fa6cf12cf60
    !!! esrc.EventSource.~this() : esrc.Signal (owner STOPPER, fd 
= 25) this @ 0x7fa6cf12cf90

WHY this is not happening with echo-server???



More information about the Digitalmars-d-learn mailing list