-
Notifications
You must be signed in to change notification settings - Fork 2k
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
It seems the socket upstream pointer changed while processing concurrent requests. #150
Comments
Hello! On Wed, Aug 8, 2012 at 7:35 PM, Simon notifications@github.com wrote:
Are you sharing cosocket objects among all requests by hooking them up You'll get the "socket busy" exception when concurrent requests try to Best regards, |
I'm not sure is this a shared cosocket object? content_by_lua: 1 local mongo = require "resty.mongol" init.lua: 9 local socket = ngx.socket.tcp 129 function new(self) And if it's a shared object, will all request use the same upstream 于 2012-8-9 11:31, agentzh (章亦春) 写道:
|
Hello! On Wed, Aug 8, 2012 at 8:52 PM, Simon notifications@github.com wrote:
It seems not. Are you turning lua_code_cache off? disabling the Lua code cache will And also, could you provide a minimized but complete example that can Thanks! |
于 2012-8-9 12:02, agentzh (章亦春) 写道:
|
It's about the global value. I think the Does the global value have side effect?
I can't reproduce this by other test case with simple socket operations. So could you downlaod the mongodb |
Hello! On Wed, Aug 8, 2012 at 7:35 PM, Simon notifications@github.com wrote:
Forgot to ask you, are you actually able to observe the "socket busy" Why I'm asking is because that the upstream struct is allocated by the Thanks! |
Yes, here is the "socket busy":
It seems have nothing to do with GC. See the last 2 lines: *1 used upstream: B7230860 which belongs to *2,
|
Hello! On Thu, Aug 9, 2012 at 7:08 PM, Simon notifications@github.com wrote:
I still believe there's accidental global variables used in your To quote the related sections in ngx_lua's documentation: "It is recommended to always place the following piece of code at the
Assuming the current Lua module is named foo.bar, this will guarantee Best regards, |
It's related with the undefined variable in function block of lua modules. Thanks! |
I add a debug to print upstream pointers in
ngx_http_lua_socket_tcp_send(lua_State *L)
and make a ab test:
ab -c 2 -n 2 localhost/mongo
which to do mongodb insert and find.The req1 get the upstream pointer
B71D5FF8
which belongs to req2. So the lua scriptwill get a "socket busy" exception.
This issue only reproduced when make first ab testing after nginx starting, the second ab testing gets right result.
And restart nginx the issue will reproduced again.
The text was updated successfully, but these errors were encountered: