shareup / phoenix-apple

3 stars 0 forks source link

`testHeartbeatKeepsSocketConnected` fails on GitHub Actions #30

Closed atdrendel closed 3 years ago

atdrendel commented 3 years ago

Could this be due to the fact we force close connections at the end of the test and wait for them to close before running the next test? Closing the socket after the test has "passed" might cause this problem.

myobie commented 3 years ago

@atdrendel we have checks in place to make a "double close" a no op and we've tried both waiting until the close is "finished" and just calling close and moving on to the next test without waiting, but AFAIK they both end up with intermittent failures. Best we can come up with is that something internal to either the websockettask or urlsession has a race condition or is just programmed to reuse some resources between connections that we can't prevent. Does that jive with what you think?

atdrendel commented 3 years ago

I don't know if that's the case here. I haven't investigated this at all, but this test fails if the subscriber receives a .close message. My hypothesis is our code to shut down the connection ends up calling the subscriber before it's deallocated, which causes the failure. If I'm right, manually deleting the subscription before finishing the test should solve this issue.

myobie commented 3 years ago

Oh! I see what you are saying. OK. I'll do some exploration into this sometime this week and comment here if I learn anything.

atdrendel commented 3 years ago

It seems like this was fixed by #32