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?

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

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.

itopiz

itopiz

Where Next?

Popular in Questions Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
gonzofish
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New

Other popular topics Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
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 30048 115
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

We're in Beta

About us Mission Statement