nats-io / elixir-nats

Elixir NATS client
MIT License
76 stars 14 forks source link

The subscriber example breaks on higher traffic #18

Closed mindreframer closed 8 years ago

mindreframer commented 8 years ago

I get following error while running examples in iex: Benchscript throws similar error...

# increased the number of sent messages in publisher example, repeat a couple times...
Pub.pub_loop(pid, subject, msg, 100)
## the output of subscriber example
received NATS message: {:msg, "elixir.subject", nil, "57: this works ;)"}

10:55:36.498 [error] NATS: #PID<0.151.0>: 127.0.0.1:4222: : invalid parser result: {:cont, 0, %{lexs: {:tokens, 65, 1, '@', 1, 1, [{:arg, 1, "elixir.subject"}, {:msg, 1}], 12, 1}, msg: nil, ps: :verb, size: nil, verb: nil}}
** (EXIT from #PID<0.47.0>) "NATS err: \"invalid parser result: {:cont, 0, %{lexs: {:tokens, 65, 1, '@', 1, 1, [{:arg, 1, \\\"elixir.subject\\\"}, {:msg, 1}], 12, 1}, msg: nil, ps: :verb, size: nil, verb: nil}}\""

10:55:36.505 [error] GenServer #PID<0.152.0> terminating
** (stop) "NATS err: \"invalid parser result: {:cont, 0, %{lexs: {:tokens, 65, 1, '@', 1, 1, [{:arg, 1, \\\"elixir.subject\\\"}, {:msg, 1}], 12, 1}, msg: nil, ps: :verb, size: nil, verb: nil}}\""

What am I doing wrong? ;)

OS: Mac 10.11.1

elixir -v
Erlang/OTP 18 [erts-7.2.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.2.1

Thx!

camros commented 8 years ago

@mindreframer you are not doing anything wrong ;-)

Can you please take a look at the current master and see if you have the same issue? There were changes pushed in the last two days that should address this along with many performance and capacity issues.

mindreframer commented 8 years ago

@camros well, it seems more stable now, that's good!

But the benchmark still breaks... And I seem to overwhelm the subscriber when I choose large number of sent messages, like 10000...

Here the output:

received NATS message: {:msg, {"0", #PID<0.47.0>}, "elixir.subject", nil, "123: hello NATS world"}
received NATS message: {:msg, {"0", #PID<0.47.0>}, "elixir.subject", nil, "124: hello NATS world"}
received NATS message: {:msg, {"0", #PID<0.47.0>}, "elixir.subject", nil, "125: hello NATS world"}

16:11:43.373 [error] NATS: #PID<0.147.0>: 127.0.0.1:4222: : invalid parser result: {:error, "NATS: parsing error: invalid trailer `1049`", nil}
** (EXIT from #PID<0.47.0>) "NATS err: \"invalid parser result: {:error, \\\"NATS: parsing error: invalid trailer `1049`\\\", nil}\""

16:11:43.378 [error] GenServer #PID<0.148.0> terminating
** (stop) "NATS err: \"invalid parser result: {:error, \\\"NATS: parsing error: invalid trailer `1049`\\\", nil}\""

something I can do to help?

camros commented 8 years ago

Feel free to fix and provide a test case ;-). I have some patches around some of this, agent fixes and gen server/elixir callbacks. Planning on pushing that in a day or two.

mindreframer commented 8 years ago

OK, I'll see what I can do ;)

camros commented 8 years ago

@mindreframer I have found and fixed the issue. Will push after further regression ;-)

camros commented 8 years ago

Will address in #17

camros commented 8 years ago

@mindreframer this should be fixed in PR #17 (merged to master just now). I was able to reproduce and have a test case that covers that now. Can you confirm this is addressed for you? Thanks!

mindreframer commented 8 years ago

@camros Hey, it works!!! Confirm this bug fixed. Thx for being awesome!

camros commented 8 years ago

@mindreframer welcome, thanks for taking the time to report an issue!