On Fri, 13 Mar 2015 08:34:49 +0100, Sönke Ludwig wrote:

Am 13.03.2015 um 07:32 schrieb zhmt:

On Fri, 13 Mar 2015 03:32:58 GMT, Flamencofantasy wrote:

Runtask may be accessing 'remote' on a different thread after remote has been closed by score (exit).
Just a thought.

On Thu, 12 Mar 2015 06:05:03 GMT, zhmt wrote:

It seems that the forward method caused the error:

static void forward(TCPConnection client,TCPConnection remote)
{
	auto wtask = runTask({
			remote.write(client);
		});
	client.write(remote);
	// wait for the tasks to finish
	wtask.join();
}



According to the source code of vibe:

private void acquire()
	{
		assert(m_ctx, "Trying to acquire a closed TCP connection.");
		assert(m_ctx.readOwner == Task() && m_ctx.writeOwner == Task(), "Trying to acquire a TCP connection that is currently owned.");
		m_ctx.readOwner = m_ctx.writeOwner = Task.getThis();
	}

It assumes that the reader and writer of a connection should be the same fiber,
but in my scene, it is forwarding in both directions, so, the reader and writer fibers are not the same one.

But how to handle in this scene?

Authors of vibe, will you help me?

The code you have is supposed to work in general, but it seems like the
closing sequence produces events in an unexpected order. I'll try to
reproduce the issue.

I uploaded all my code here:
https://raw.githubusercontent.com/ezsock5/ezsock5/master/ezsock.src.zip

you could download it. It is a sock4/sock5 proxy, run it on your pc, configure network configuration of your browser(IE/Firefox) , change the proxy configuration as below:
ip :127.0.0.1, port 9990, socks4 or socks5

And then view some web pages, after a few minutes, this bug will occure again.

It typically happens in SockServer.d.

I hope I've supplied enough information. If not, reply here.