Am 17.03.2015 um 08:35 schrieb zhmt:

But I got another problem now, the fixed code works well on mac or linux , but crashes soon on windows, here is the call stack, I hope you can help again, thanks in advance:

Task terminated with unhandled exception: Acquiring reader of already owned connection.
core.exception.AssertError@..\vibe.d-inter_task_fixes\source\vibe\core\drivers\libevent2_tcp.d(373): Acquiring reader of already owned connection.
----------------
0x005557E5 in _d_assert_msg
0x004C5D79 in bool vibe.core.drivers.libevent2_tcp.Libevent2TCPConnection.waitForData(core.time.Duration) at C:\dwork\ezsock\..\vibe.d-inter_task_fixes\source\vibe\core\drivers\libevent2_tcp.d(282)
0x00437258 in int ezsockacount.NetUtil.NetUtil.readSome(vibe.core.net.TCPConnection, ubyte[]) at C:\dwork\ezsock\source\ezsockacount\NetUtil.d(112)
0x0043841E in D12ezsockacount19SpeedLimitForwarder19SpeedLimitForwarder7forwardMFC4vibe4core3net13TCPConnection at C:\dwork\ezsock\source\ezsockacount\SpeedLimitForwarder.d(61)
0x004382E3 in D12ezsockacount19SpeedLimitForwarder19SpeedLimitForwarder10tryForwardMFC4vibe4core3net13TCPConnectionC4vibe4core3net13TCPConnectionZ9__lambda3 at
C:\dwork\ezsock\source\ezsockacount\SpeedLimitForwarder.d(35)
0x00412ADE in void vibe.core.core.makeTaskFuncInfo!(void delegate()).makeTaskFuncInfo(ref void delegate()).callDelegate(vibe.core.core.TaskFuncInfo*) at C:\dwork\ezsock\..\vibe.d-inter_task_fixes\source\vibe\core\core.d(464)
0x00467FE7 in void vibe.core.core.CoreTask.run() at C:\dwork\ezsock\..\vibe.d-inter_task_fixes\source\vibe\core\core.d(967)
0x0056A635 in void core.thread.Fiber.run()
There are still tasks running at exit.

Is it possible that the same connection is actually accessed by a
different task concurrently? By looking at the implementation of close()
and waitForData() it doesn't seem possible that the assertion is
triggered when those two are used concurrently, so it would have to be
something else that is responsible.

I'm thinking of adding a Task.name property that gets printed out in
such situations to aid debugging.