elixir-lang / gen_stage

Producer and consumer actors with back-pressure for Elixir
http://hexdocs.pm/gen_stage
1.48k stars 192 forks source link

no function clause matching in GenStage.maybe_producer_cancel/2 #285

Closed halturin closed 2 years ago

halturin commented 2 years ago

I've got an issue report and trying to realize the reason what's happening on the producer side https://github.com/ergo-services/ergo/issues/103

Ergo has gen.Stage implementation, which is expected to be compatible with the gen_stage, but something doesn't work, and I have no clue which side caused this issue. I would appreciate it if you could help me with it.

josevalim commented 2 years ago

Unfortunately I have a little time to help with this, given I picked up the hand injury and my computer time is limited. My suggestion is to try the Elixir Forum and see if someone with GenStage experience is available to help. :)

halturin commented 2 years ago

It's up to you for sure, but I believe, that no anyone outside should cause the elixir producer process to fail.

here is what I see on the elixir producer side after making the 'ask' (demand) request being successfully subscribed

23:30:32.622 [error] GenServer Producer terminating                                                                                                              
** (FunctionClauseError) no function clause matching in GenStage.maybe_producer_cancel/2                                                                         
    (gen_stage 1.1.2) lib/gen_stage.ex:2236: GenStage.maybe_producer_cancel([], %GenStage{buffer: {{[], []}, 0, 10000}, buffer_keep: :last, consumers: %{}, dispa
tcher_mod: GenStage.DemandDispatcher, dispatcher_state: {[], 0, nil, false}, events: :forward, mod: Producer, monitors: %{}, producers: %{}, state: 0, type: :pro
ducer})                                                                                                                                                          
    (gen_stage 1.1.2) lib/gen_stage.ex:1938: GenStage.handle_info/2                                                                                              
    (stdlib 3.17) gen_server.erl:695: :gen_server.try_dispatch/4                                                                                                 
    (stdlib 3.17) gen_server.erl:771: :gen_server.handle_msg/6                                                                                                   
    (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3                                                                                                  
Last message: {:"$gen_producer", {#PID<26758.1008.0>, #Reference<26758.0.23478.108198>}, {:subscribe, [], [min_demand: 1, max_demand: 5, cancel: 0, manual: false
, partition: 0]}}                                                                                                                                                
State: 0                                                                                                                                                         
Producer started