cloudflare / lua-resty-logger-socket

Raw-socket-based Logger Library for Nginx (based on ngx_lua)
488 stars 130 forks source link

log_by_lua is not allowed while logging request #15

Closed lilien1010 closed 9 years ago

lilien1010 commented 9 years ago

I think that the cosock API is not allowed to run in logging request

" log_by_lua(nginx.conf:209):2: in function <log_by_lua(nginx.conf:209):1> while logging request,"

agentzh commented 9 years ago

@lilien1010 This library does cosockets in the timers created by the context of log_by_lua* and etc rather than doing cosockes directly in log_by_lua*. See the ngx.timer.at API.

agentzh commented 9 years ago

@lilien1010 If you're reporting a problem in this library, then I must say your error message is incomplete and you didn't show a minimal code and configuration example to demonstrate the problem.

lilien1010 commented 9 years ago

@agentzh Oh I see,I checked your source code, but not carefully, I thought you are using ngx.socket.tcp directly. -------- actually Here is what I am looking for I handle a http request by content_by_lua_file , and I need to send result data to another TCP server, and keep this TCP connection alive , but setkeepalive won't work

agentzh commented 9 years ago

@lilien1010 Your last question is already off the topic. Please use the openresty-en mailing list instead. BTW, please read the documentation of setkeepalive carefully and properly handle any errors returned by setkeepalive() yourself in Lua before asking questions (because most of the time, it's just simple mistakes on the user's side). Thanks for your cooperation.

calio commented 9 years ago

@lilien1010 If you are asking about how to use cosocket, this is really off the topic. I'm closing this for now, discussion in openresty-en mailing list is recommended.