1

Got a module that should keep running in the background as a tcp server waiting and serving connections.

When I start my module by first running erlang shell and then calling my module, it works fine,

However, if I run it directly via erl -s or -eval -run etc, Supervisor that supervises tcp server complains no match for the right hand side..{error, closed} and fails.

System:Ubuntu 18

Update: Here is what might be wrong, Working on it...

Update: Solved by unlinking supervisor for now, will use proper releases in future.

asim
  • 533
  • 6
  • 17
  • It's difficult to help you since you didn't post your code, but I'd guess you have a `gen_tcp:recv/2,3` call somewhere that isn't handling `{error, closed}`. – Steve Vinoski Jan 05 '20 at 20:23
  • Issue seems to be on accept, maybe its not letting it wait for connections, Feels like its terminating running code before returning back on me, it shouldn't @SteveVinoski – asim Jan 06 '20 at 12:08
  • A closed listen socket makes `accept` return `{error, closed}`, so make sure the process owning the listen socket isn't dying and taking that socket down with it. – Steve Vinoski Jan 06 '20 at 12:43
  • thats the issue, why is it dying when started directly using erl -s but NOT dying when started from erlang shell? – asim Jan 06 '20 at 13:15
  • I would have to see your code and see how you're using the shell to be able to answer that. – Steve Vinoski Jan 06 '20 at 13:31
  • Currently in the process of making rel, if it doesnt work, will post relevant code – asim Jan 06 '20 at 13:39

0 Answers0