itopiz

itopiz

Tests trigger `unknown registry: MyApp.EventStore.EventStore.PubSub` while migrating to Elixir 1.15

Hi,

I am trying to migrate an application from Elixir 1.14.5 to 1.15.7.
All my tests pass but they trigger additional errors related to commanded and eventstore:

Most of the errors are: unknown registry: MyApp.EventStore.EventStore.PubSub as shown here:

16:05:55.218 [error] GenServer {MyApp.EventStore.EventStore.Subscriptions.Registry, {"$all", "MyProcessManager"}} terminating
** (ArgumentError) unknown registry: MyApp.EventStore.EventStore.PubSub
    (elixir 1.15.7) lib/registry.ex:1391: Registry.info!/1
    (elixir 1.15.7) lib/registry.ex:1007: Registry.register/3
    (eventstore 1.4.7) lib/event_store/pubsub.ex:38: EventStore.PubSub.subscribe/3
    (eventstore 1.4.7) lib/event_store/subscriptions/subscription_fsm.ex:70: EventStore.Subscriptions.SubscriptionFsm.transition/3
    (eventstore 1.4.7) lib/event_store/subscriptions/subscription.ex:221: EventStore.Subscriptions.Subscription.handle_call/3
    (stdlib 4.3.1.6) gen_server.erl:1149: :gen_server.try_handle_call/4
    (stdlib 4.3.1.6) gen_server.erl:1178: :gen_server.handle_msg/6
    (stdlib 4.3.1.6) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.16668.1>): {:connect, #PID<0.16668.1>, [retry_interval: 60000, hibernate_after: 15000, partition_by: nil, concurrency_limit: 1, name: MyApp.EventStore, mapper: &Commanded.EventStore.Adapters.EventStore.Mapper.from_recorded_event/1, conn: MyApp.EventStore.Postgrex, event_store: MyApp.EventStore, query_timeout: 15000, schema: "public", serializer: Commanded.Serialization.JsonSerializer, stream_uuid: "$all", subscription_name: "MyProcessManager", start_from: 0]}
domain=otp file=gen_server.erl line=1402 mfa=:gen_server.error_info/8 pid=<0.16687.1>

Less often I also have: 1st argument: the table identifier does not refer to an existing ETS table as shown here:

16:05:56.398 [error] GenServer {MyApp.EventStore.EventStore.Subscriptions.Registry, {"$all", "MyProcessManager"}} terminating
** (ArgumentError) errors were found at the given arguments:

  * 1st argument: the table identifier does not refer to an existing ETS table

    (stdlib 4.3.1.6) :ets.insert(#Reference<0.4090088613.484835331.67685>, {#PID<0.17183.1>, "$all", #Reference<0.4090088613.484835331.67684>, -576460752299835900})
    (elixir 1.15.7) lib/registry.ex:1018: Registry.register/3
    (eventstore 1.4.7) lib/event_store/pubsub.ex:38: EventStore.PubSub.subscribe/3
    (eventstore 1.4.7) lib/event_store/subscriptions/subscription_fsm.ex:70: EventStore.Subscriptions.SubscriptionFsm.transition/3
    (eventstore 1.4.7) lib/event_store/subscriptions/subscription.ex:221: EventStore.Subscriptions.Subscription.handle_call/3
    (stdlib 4.3.1.6) gen_server.erl:1149: :gen_server.try_handle_call/4
    (stdlib 4.3.1.6) gen_server.erl:1178: :gen_server.handle_msg/6
    (stdlib 4.3.1.6) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.17166.1>): {:connect, #PID<0.17166.1>, [retry_interval: 60000, hibernate_after: 15000, partition_by: nil, concurrency_limit: 1, name: MyApp.EventStore, mapper: &Commanded.EventStore.Adapters.EventStore.Mapper.from_recorded_event/1, conn: MyApp.EventStore.Postgrex, event_store: MyApp.EventStore, query_timeout: 15000, schema: "public", serializer: Commanded.Serialization.JsonSerializer, stream_uuid: "$all", subscription_name: "MyProcessManager", start_from: 0]}
domain=otp file=gen_server.erl line=1402 mfa=:gen_server.error_info/8 pid=<0.17183.1>

The 2 error stacks have a lot in common. Somehow eventstore is trying to do something with what appears to be a registry linked to a dead process.

I have a lot of tests that run in parallel. If I try to run 1 test file at the time, no error occur. But if I run 2 test files in parallel, error sometime occur. It is difficult to reproduce because it is not predictable.

I do not know how to troubleshoot this. I have re-read the Commanded documentation in particular regarding Application and Process managers and I believe I do what the documentation recommends.

Any idea? @slashdotdash perhaps?

Marked As Solved

drteeth

drteeth

This appears to resolve the issue, can you run against that branch and let me know how it goes?

https://github.com/commanded/eventstore/pull/300

Also Liked

ken-kost

ken-kost

Why are you upgrading to that specific version and what happens if you go higher, for instance latest version, or 1.16? Also what about erlang version(s)?

itopiz

itopiz

Adding start_from: :current made the problem more reproducible but I could not find a solution.

I built a short repository that reproduces the issue when running mix test. On my side, error messages show up more than 50% of the time I run mix test.

The repo is available at: GitHub - datafoo/elixir-1.15-registry-issue · GitHub

Thank you for your help so far.

dimitarvp

dimitarvp

Extra advice: include a .tool-versions file in the repo, and put some little README.md file to describe what is this repository reproducing as a problem. A screenshot or copied logging output should orient any visitor.

Where Next?

Popular in Questions Top

nobody
How to bind a phoenix app to a specific ip address? could not find anything about that, nowhere, unfortunately, but for me this is quite...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New

Other popular topics Top

AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31265 143
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31013 112
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement