Unity app Crashing when reopening from Background after idling for ~10+ minutes

Open
#49 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
csharp, ios, unity

Research direction

Reproduce the issue with the described empty Unity project on iOS 13+ by connecting to the server, backgrounding the app for about 10 minutes, and reopening it. Start with Websocket.cs Connect(), especially the await Receive() call, and inspect the interval between applicationWillEnterForeground and applicationDidBecomeActive in Xcode; done means the intermittent crash is understood and no longer occurs.

Written by the indexing model from the issue text.

Description

This crash seems like it only occurs in iOS 13+ and is intermittent. I get it occur about 20% of the time. The error in xCode reads something like IL2CPP Threadpool worker (44): EXC_BAD_ACCESS (code=1, address=0x18). The address part slightly changes sometimes, but the rest is the same.

I created an empty project where I just connect to our server and then minimize the app by tapping the power button on the iPad. After waiting ~10 minutes or so reopen the app. About 20% of the time, the app will crash. Xcode doesn't seem to be logging anything from Unity. I just get the error After applicationwillenterforeground and before applicationdidbecomeactive. I've tried debugging this for a while now, with little luck because of the lack of logging. I did notice during debugging when I commented out the await Receive() call in Websocket.cs Connect() it stopped crashing, but of course I can't receive messages at that point.

Has anyone else had a similar issue? Anyone have any ideas?

Dominant language
C#
Stars
1.7k
Forks
206
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from endel/NativeWebSocket

All issues in endel/NativeWebSocket

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.