turbo
turbo copied to clipboard
Server crashes after 64 requests on OSX
Hi, I am testing a very simple implementation of a json request handler but it seems that the server drops after 64 requests. Does it have to do with the sockets available ?
Here is the code of the server as taken from the examples
local turbo = require "turbo"
local MyJSONHandler = class("MyJSONHandler", turbo.web.RequestHandler)
function MyJSONHandler:get()
self:write({ "one", "two", "three", "easy", "json" })
end
turbo.web.Application:new({
{"^/json$", MyJSONHandler}
}):listen(8888)
turbo.ioloop.instance():start()
And to test it I just run a simple python request script:
import requests
for i in range(65):
r = requests.get("http://localhost:8888/json")
print r.text
Error msg:
[E 2016/02/18 00:52:15] [ioloop.lua] Error in IOLoop handler. ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼ /usr/local/share/lua/5.1/turbo/ioloop.lua:120: attempt to call field 'strerror' (a nil value)
Any ideas ? I'm pretty sure I'm missing something from the code but from the current documentation/ examples I can;t figure out why. ( I just started using LUA so reading source code hasn't been productive ;) ) Thanks :)
What OS? Seems like a Windows specific? tor. 18. feb. 2016 kl. 02.01 skrev Stathis V. [email protected]:
Hi, I am testing a very simple implementation of a json request handler but it seems that the server drops after 64 requests. Does it have to do with the sockets available ?
Here is the code of the server as taken from the examples
local turbo = require "turbo"
local MyJSONHandler = class("MyJSONHandler", turbo.web.RequestHandler) function MyJSONHandler:get() self:write({ "one", "two", "three", "easy", "json" }) end
turbo.web.Application:new({ {"^/json$", MyJSONHandler} }):listen(8888)
turbo.ioloop.instance():start()
And to test it I just run a simple python request script:
import requests for i in range(65): r = requests.get("http://localhost:8888/json") print r.text
Error msg:
[E 2016/02/18 00:52:15] [ioloop.lua] Error in IOLoop handler.
▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼ /usr/local/share/lua/5.1/turbo/ioloop.lua:120: attempt to call field 'strerror' (a nil value)
Any ideas ? I'm pretty sure I'm missing something from the code but from the current documentation/ examples I can;t figure out why. ( I just started using LUA so reading source code hasn't been productive ;) ) Thanks :)
— Reply to this email directly or view it on GitHub https://github.com/kernelsauce/turbo/issues/248.
Mvh / Best regards John Abrahamsen Tlf/Phone: (+47) 941 35 009
I'm on OS X 10.11.3 , you think it's OS related ?
Thanks, Stathis
I check your code on Linux Debian 8.2 with python 2.7 and requests-2.9.1 No crash.
@yurayko Thanks. It might be an OS X thing. I'll run my server on my linux box then.
It is indeed a OSX thing, turbo uses the luasocket library on anything but Linux. It should work, but I guess there is some oddities in OSX. I will investigate it.
tor. 18. feb. 2016 kl. 12.11 skrev Stathis V. [email protected]:
@yurayko https://github.com/yurayko Thanks. It might be an OS X thing. I'll run my server on my linux box then.
— Reply to this email directly or view it on GitHub https://github.com/kernelsauce/turbo/issues/248#issuecomment-185663435.
Mvh / Best regards John Abrahamsen Tlf/Phone: (+47) 941 35 009