aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Mihajlovic <[email protected]>2019-03-01 20:18:37 +0100
committerLoïc Hoguin <[email protected]>2019-04-25 10:32:12 +0200
commitc35d399138e99d3615a3ceac40a2440030d9a2ef (patch)
tree429db83664be6b2d1e780d34c6b823d09fa70ef7
parent561847bb14e91e20e4e5f0106d33d693cd575498 (diff)
downloadgun-c35d399138e99d3615a3ceac40a2440030d9a2ef.tar.gz
gun-c35d399138e99d3615a3ceac40a2440030d9a2ef.tar.bz2
gun-c35d399138e99d3615a3ceac40a2440030d9a2ef.zip
Remove explicit call to dbg:start/0
This fixes a bug in `gun` when trying to open 2 connections with tracing enabled. You can recreate it like so: > application:ensure_all_started(gun). > gun:open("localhost", 80, #{trace => true}). > gun:open("localhost", 80, #{trace => true}). The second call fails with a cause clause exception. You'll observe the same exception by: > dbg:start(). > dbg:start(). Ultimately this may be a bug in OTP, but since `dbg:start/0` is undocumented I'm inclined to give it the benefit of the doubt. Regardless, since the docs[1] clearly state that calling `dbg:tracer/0` is the proper way to start the default tracer message receiver, I argue that calling `dbg:start/0` is a bug in `gun`. [1]: http://erlang.org/doc/man/dbg.html
-rw-r--r--src/gun.erl1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/gun.erl b/src/gun.erl
index d209450..7ab13c0 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -277,7 +277,6 @@ check_options([Opt|_]) ->
{error, {options, Opt}}.
consider_tracing(ServerPid, #{trace := true}) ->
- dbg:start(),
dbg:tracer(),
dbg:tpl(gun, [{'_', [], [{return_trace}]}]),
dbg:tpl(gun_http, [{'_', [], [{return_trace}]}]),