Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running concurrent requests segfaults #30

Closed
simendsjo opened this issue May 1, 2012 · 9 comments
Closed

Running concurrent requests segfaults #30

simendsjo opened this issue May 1, 2012 · 9 comments
Assignees

Comments

@simendsjo
Copy link
Contributor

I tried running a couple of concurrent requests using ab, and it sometimes fails.
The line that breaks is this one: https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/core/drivers/libevent2_tcp.d#L360
assert(client_ctx) fails after connectionCallback() is called in the line above.

@s-ludwig
Copy link
Member

s-ludwig commented May 1, 2012

Interesting.. a closure bug? The client_ctx is modified nowhere...

@ghost ghost assigned s-ludwig May 1, 2012
@simendsjo
Copy link
Contributor Author

Hmmm.. Seems there are some strange stuff going on. If I reduce the test-case to this:
void index(HttpServerRequest req, HttpServerResponse res) { auto cn = new Connection("localhost", "user", "password", "database"); scope(exit) cn.close(); }

Then I get other errors:

[7FFFF7EC8F00:7FFFF7F37380 WRN] A socket error occurred on fd 23: 32

Program received signal SIGSEGV, Segmentation fault.
0x0000000000586f0c in rt.deh2.terminate() ()
(gdb) l
1       dlopen.c: No such file or directory.
        in dlopen.c

Adding in a little more sql:
void index(HttpServerRequest req, HttpServerResponse res) { auto cn = new Connection("localhost", "user", "password", "database"); scope(exit) cn.close(); auto cmd = Command(cn, "SELECT * FROM user"); auto data = cmd.execSQLResult(); while(!data.empty) { data.popFront(); } }

Gives other problems:
Program received signal SIGSEGV, Segmentation fault. 0x00000000005851cd in gc.gcx.Gcx.mark() ()

But if I sprinkle with writeln's, I reproduce the error I first reported...

@simendsjo
Copy link
Contributor Author

Oh.. And I get failures even without concurrent requests, but a little different. With all writeln's, I get the second reported issue rather than the first when running with 1 request at a time.

I really have no idea how I can be of any help finding the source of this bug.

@s-ludwig
Copy link
Member

Unfortunately, I currently don't have any time left to debug the MySQL stuff. If nobody else does it, I will try to get to this in two or three weeks.

@simendsjo
Copy link
Contributor Author

Hmm.. I'm running a branch with some changes now, and the problem is gone (at least I think the remaining problem is vibe or druntime).

@simendsjo
Copy link
Contributor Author

It fails on a simple "Hello world" app too.

ab -n1000000 -c1000 http://localhost:8080/

Usually fails before reaching 100,000 for me.

Of course.. It runs fine for smaller number of concurrent users, so it's obviously not an issue for my use, but it might hide some other errors.

@s-ludwig
Copy link
Member

Interesting. I do get some failed connections sometimes and I think it's a timing issue where the new connection is not accept'ed fast enough. It doesn't crash though. Hopefully when it's finished, the win32 back end will provide a better target for debugging this. Libevent hides a lot of things under it's abstractions...

@simendsjo
Copy link
Contributor Author

I get strange segfaults on linux64 at least. Haven't tested on windows or x32.

@s-ludwig
Copy link
Member

s-ludwig commented Sep 5, 2013

Closing for now due to non-reproducibility over a long period of time.

@s-ludwig s-ludwig closed this as completed Sep 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants