You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So json_map today has a flaw in that it creates a closure and that can accidentally close over a large objects. For example, Nebo15/logger_json library does this:
Since conn.method is being passed to json_map, a closure pointing to conn will be created. Then the whole conn is sent to the Logger process, which may cause spikes in memory usage.
The fix is logger_json is simple but, since json_map is somewhat changing the semantics of the code, it may be worth fixing it in Jason instead?
The text was updated successfully, but these errors were encountered:
So
json_map
today has a flaw in that it creates a closure and that can accidentally close over a large objects. For example, Nebo15/logger_json library does this:https://github.com/Nebo15/logger_json/blob/e041318e496affdfc44226c33dac38e98a37695a/lib/logger_json/plug/metadata_formatters/google_cloud_logger.ex#L23
Since
conn.method
is being passed tojson_map
, a closure pointing toconn
will be created. Then the wholeconn
is sent to the Logger process, which may cause spikes in memory usage.The fix is
logger_json
is simple but, sincejson_map
is somewhat changing the semantics of the code, it may be worth fixing it in Jason instead?The text was updated successfully, but these errors were encountered: