Closed hamann closed 7 years ago
Ok,as far as I understand, the :emfile
-error means that all system file descriptors are out, and that there's no room for the single socket that logger needs for sending. Since it's a single process gen_server that closes it's socket, I doubt it's papertrail-logger that's the underlying problem.
A viable solution should be rewriting sender to cache up messages. A future version should probably use GenStage
.
@larskrantz yeah, probably we ran out of file descriptors due to some OS limits. just wanted to let you know that such problem could occur
Thanks, will have it mind!
@larskrantz what do you think about sharing the socket instead of opening/closing a socket each time a log message is generated?
{:ok, socket} = :gen_udp.open(0)
:gen_udp.send(socket, ip, port, message)
:gen_udp.close(socket)
That should solve the problem above, and on busy and chatty systems it should be less expensive
Yes, I'll try a version opening the socket at init, since its a 0-udp-socket I guess it's ok to have it open all the time and store it in state (and close it at termination).
Today we had more traffic as usual on our website and after a while the application crashed
otp: 19.1.3 logger_papertrail_backend: 0.1
Last lines from error log at that time:
Extract from crash dump