Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard against nil publishes #166

Open
mmmries opened this issue Jul 25, 2024 · 0 comments
Open

Guard against nil publishes #166

mmmries opened this issue Jul 25, 2024 · 0 comments

Comments

@mmmries
Copy link
Collaborator

mmmries commented Jul 25, 2024

Our team at work had a case recently where we got an error log like this:

** (stop) exited in: GenServer.call(#PID<0.9002.25>, {:pub, nil, "+NXT", [reply_to: "_INBOX.AsRgaR8WHynMUJBk"]}, 5000)
    ** (EXIT) an exception was raised:
        ** (ArgumentError) errors were found at the given arguments:

  * 1st argument: not an iodata term

            :erlang.iolist_to_iovec([["PUB", " ", nil, " ", "_INBOX.AsRgaR8WHynMUJBk", " 4", "\r
", "+NXT", "\r
"]])
            (ssl 10.8.4) ssl.erl:856: :ssl.send/2
            (gnat 1.6.0) lib/gnat.ex:434: Gnat.handle_call/3
            (stdlib 4.1) gen_server.erl:1149: :gen_server.try_handle_call/4
            (stdlib 4.1) gen_server.erl:1178: :gen_server.handle_msg/6
            (stdlib 4.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
    (elixir 1.14.5) lib/gen_server.ex:1038: GenServer.call/3
    (gnat 1.6.0) lib/gnat.ex:211: Gnat.pub/4
    (jetstream 0.0.8) lib/jetstream/pull_consumer/server.ex:195: Jetstream.PullConsumer.Server.handle_info/2
    (connection 1.1.0) lib/connection.ex:810: Connection.handle_async/3
    (stdlib 4.1) gen_server.erl:1123: :gen_server.try_dispatch/4
    (stdlib 4.1) gen_server.erl:1200: :gen_server.handle_msg/6

This looks like a case where we are passing a nil value into one of the pubic Gnat functions and it is getting passed along in a message to the connection process where it crashes because it isn't a valid iolist. This seems like something that should return an error or raise an ArgumentError if a nil is passed into the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant