vectordotdev / timber-elixir

🌲 Great Elixir logging made easy
https://timber.io
Other
214 stars 29 forks source link

Switch to `async: true` instead of `async: :once` since it causes memory issues #337

Closed binarylogic closed 5 years ago

binarylogic commented 5 years ago

This fixes a memory issue with a dependency library (:hackney) where setting the async: :once option causes memory to continually grow. Using async: true does not have this same effect.

jszwedko commented 5 years ago

Aha, interesting, I see async: :once would tell it to only read receive once:

Note 1: When {async, once} is used the socket will receive only once. To receive the other messages use the function hackney:stream_next/1.

I assume there was still data left on the socket?

Does this have any implications for keep-alive / http pipelining?

binarylogic commented 5 years ago

Yeah, I spoke with @mitchellhenke about this yesterday, apparently this is meant to be manually read / closed. You need to use :hackney.stream_next/1 and :hackney.async_stop/1 when you're done. I still prefer this new method since what's outline here has more opportunity for failure and missed cleanup.

jszwedko commented 5 years ago

Gotcha :+1: