fabriziosestito / commanded-spear-adapter

Spear event store adapter for Commanded
MIT License
19 stars 5 forks source link

Exception on app start #15

Closed philipgiuliani closed 2 years ago

philipgiuliani commented 2 years ago

In some cases the application reports the following error after starting:

12:17:56.155 [error] GenServer Dia.App.Spear.Commanded.EventStore.Adapters.Spear.EventPublisher terminating
** (stop) exited in: :gen_server.call(Dia.App.Spear.Spear.Connection, {{:subscription, #PID<0.2511.0>, #Function<12.19521793/2 in Spear.subscribe/4>}, %Spear.Request{api: {Spear.Records.Streams, :Read}, credentials: nil, headers: [{"te", "trailers"}, {"content-type", "application/grpc+proto"}, {"grpc-endcoding", "identity"}, {"grpc-accept-encoding", "identity,deflate,gzip"}, {"accept-encoding", "identity"}, {"user-agent", "grpc-elixir-spear/1.1.0 (mint 1.4.2; Elixir 1.13.4; OTP 25)"}], messages: ["event_store.client.streams.ReadReq": {:"event_store.client.streams.ReadReq.Options", {:stream, {:"event_store.client.streams.ReadReq.Options.StreamOptions", {:"event_store.client.StreamIdentifier", "$ce-dia_v1"}, {:start, {:"event_store.client.Empty"}}}}, :Forwards, true, {:subscription, {:"event_store.client.streams.ReadReq.Options.SubscriptionOptions"}}, {:no_filter, {:"event_store.client.Empty"}}, {:"event_store.client.streams.ReadReq.Options.UUIDOption", {:string, {:"event_store.client.Empty"}}}, {:"event_store.client.streams.ReadReq.Options.ControlOption", 1}}], path: "/event_store.client.streams.Streams/Read", rpc: %Spear.Rpc{name: :Read, path: "/event_store.client.streams.Streams/Read", request_stream?: false, request_type: :"event_store.client.streams.ReadReq", response_stream?: true, response_type: :"event_store.client.streams.ReadResp", service: :"event_store.client.streams.Streams", service_module: :event_store_db_gpb_protobufs_streams}, service: :"event_store.client.streams.Streams", service_module: :event_store_db_gpb_protobufs_streams}}, 5000)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
    (stdlib 4.0.1) gen_server.erl:382: :gen_server.call/3
    (commanded_spear_adapter 0.1.0) lib/commanded/event_store/adapters/spear/event_publisher.ex:38: Commanded.EventStore.Adapters.Spear.EventPublisher.handle_cast/2
    (stdlib 4.0.1) gen_server.erl:1120: :gen_server.try_dispatch/4
    (stdlib 4.0.1) gen_server.erl:1197: :gen_server.handle_msg/6
    (stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", :subscribe}

The error only occurs once, and the application works as expected. I guess that the Spear Connection process is not yet started when the EventPublisher starts.