mixpanel-swift icon indicating copy to clipboard operation
mixpanel-swift copied to clipboard

Lots of crashes on `FlushRequest.sendRequest(_:type:useIP:completion:)` with 4.0.4

Open malcommac opened this issue 2 years ago • 17 comments

Integration Method: SPM Xcode Version: 14.1.0 Library Version: 4.0.4 Platform: iOS Language: Swift Description:

We got lots of crashes using the 4.0.4 release on FlushRequest.sendRequest(_:type:useIP:completion:):

image

The raw stack trace:

malcommac avatar Jan 12 '23 10:01 malcommac

@malcommac Are you able to reproduce this issue? If so, can you provide the steps? Were you using older versions without this problem? If so, what version were you upgrading from? Any additional info you can provide would be helpful.

jaredmixpanel avatar Jan 24 '23 21:01 jaredmixpanel

Before that, we used 3.5.1 without the issue. Unfortunately, I'm not able to reproduce this issue, but it seems to be happening at the early stage of the app launch. Maybe it could be related to some flush events of the local events not sent in the previous session?

malcommac avatar Jan 26 '23 07:01 malcommac

I wonder if anyone read these issues.

CleanShot 2023-04-14 at 12 17 24@2x

Anyway it still the most relevant crash issue in our app right after the startup (100% of crash events for this issue happened in the first 5 seconds of a user's session).

Crashed: com.mixpanel.caf0d89293f630a8e27cdb2914e3ef57.network)
SIGSEGV 0x0000000000000000

Crashed: com.mixpanel.caf0d89293f630a8e27cdb2914e3ef57.network)
0  Indomio                        0xa90168 FlushRequest.sendRequest(_:type:useIP:completion:) + 4383342952
1  Indomio                        0xa8f1a0 Flush.flushQueueInBatches(_:type:) + 4383338912
2  Indomio                        0xaace4c closure #1 in closure #1 in MixpanelInstance.flush(completion:) + 4383460940
3  Indomio                        0x2f70c thunk for @escaping @callee_guaranteed () -> () + 4372461324
4  libdispatch.dylib              0x2460 _dispatch_call_block_and_release + 32
5  libdispatch.dylib              0x3f88 _dispatch_client_callout + 20
6  libdispatch.dylib              0xb640 _dispatch_lane_serial_drain + 672
7  libdispatch.dylib              0xc18c _dispatch_lane_invoke + 384
8  libdispatch.dylib              0x16e10 _dispatch_workloop_worker_thread + 652
9  libsystem_pthread.dylib        0xdf8 _pthread_wqthread + 288
10 libsystem_pthread.dylib        0xb98 start_wqthread + 8

Full Stacktrace

malcommac avatar Apr 14 '23 10:04 malcommac

@malcommac Apologies for the lack of progress here but I was never able to reproduce this crash and this is the only report we have. If you get additional information, particularly anything that might help reproduce the issue please add it here.

jaredmixpanel avatar Apr 14 '23 17:04 jaredmixpanel

Hello all. This bug is happening to us also, with exactly the same stack trace. On our case, all crashes happen within the first second of execution. We have tried to debug it, but is difficult to reproduce.

yeraydavidrodriguez avatar May 25 '23 09:05 yeraydavidrodriguez

Hello, We are also having this crash since we integrated Mixpanel. It is currently the top crash in our app. We also noticed it happens at the first second of opening the app.

pmgsPT avatar Jun 19 '23 09:06 pmgsPT

Hello @jaredmixpanel. Have Mixpanel plans for checking this? Because it is the first cause of crashes in our app, and as you see we are not the only ones affected. Thanks!

yeraydavidrodriguez avatar Jun 27 '23 10:06 yeraydavidrodriguez

+1

happens in 4.1.0

Crashed: com.mixpanel.98b4601e9379667d3d2e678444373306.network)
0  <redacted>                    0xa493d0 FlushRequest.sendRequest(_:type:useIP:completion:) + 30 (Network.swift:30)
1  <redacted>                    0xa48408 Flush.flushQueueInBatches(_:type:) + 109 (Flush.swift:109)
2  <redacted>                    0xa66a38 closure #1 in closure #1 in MixpanelInstance.flush(performFullFlush:completion:) + 973 (MixpanelInstance.swift:973)
3  <redacted>                    0xa5e434 thunk for @escaping @callee_guaranteed () -> () + 4317127732 (<compiler-generated>:4317127732)
4  libdispatch.dylib              0x2320 _dispatch_call_block_and_release + 32
5  libdispatch.dylib              0x3eac _dispatch_client_callout + 20
6  libdispatch.dylib              0xb534 _dispatch_lane_serial_drain + 668
7  libdispatch.dylib              0xc0d8 _dispatch_lane_invoke + 436
8  libdispatch.dylib              0x16cdc _dispatch_workloop_worker_thread + 648
9  libsystem_pthread.dylib        0xddc _pthread_wqthread + 288
10 libsystem_pthread.dylib        0xb7c start_wqthread + 8

gfoldv avatar Jul 17 '23 15:07 gfoldv

@malcommac @yeraydavidrodriguez @pmgsPT @gfoldv Just released v4.1.4 with a possible fix for this issue. Once you've updated please report back and let us know the results.

jaredmixpanel avatar Jul 19 '23 23:07 jaredmixpanel

I'll try and let u know asap, thx

malcommac avatar Jul 20 '23 07:07 malcommac

Still an issue in the v4.1.4 Pretty much the same stacktrace

Crashed: com.mixpanel.98b4601e9379667d3d2e678444373306.network)
0  <redacted>                    0xa75810 FlushRequest.sendRequest(_:type:useIP:) + 30 (Network.swift:30)
1  <redacted>                    0xa74db8 Flush.flushQueueInBatches(_:type:) + 107 (Flush.swift:107)
2  <redacted>                    0xa94ae8 closure #1 in closure #1 in MixpanelInstance.flush(performFullFlush:completion:) + 973 (MixpanelInstance.swift:973)
3  <redacted>                    0xa8c428 thunk for @escaping @callee_guaranteed () -> () + 4388946984 (<compiler-generated>:4388946984)
4  libdispatch.dylib              0x26a8 _dispatch_call_block_and_release + 32
5  libdispatch.dylib              0x4300 _dispatch_client_callout + 20
6  libdispatch.dylib              0xb894 _dispatch_lane_serial_drain + 748
7  libdispatch.dylib              0xc3f8 _dispatch_lane_invoke + 432
8  libdispatch.dylib              0x17004 _dispatch_root_queue_drain_deferred_wlh + 288
9  libdispatch.dylib              0x16878 _dispatch_workloop_worker_thread + 404
10 libsystem_pthread.dylib        0x1964 _pthread_wqthread + 288
11 libsystem_pthread.dylib        0x1a04 start_wqthread + 8

Please note, that the crash happens in the Network.swift -> line 30

Additional info (if it helps). The following code is used to initialize the SDK.

let token = AppSettings.shared.mixpanelToken
let instanceName = AppSettings.shared.mixpanelInstanceName
Mixpanel.initialize(token: token, trackAutomaticEvents: false, instanceName: instanceName)
        
Mixpanel.mainInstance().serverURL = "https://api-eu.mixpanel.com"
        
Mixpanel.mainInstance().flushOnBackground = true
Mixpanel.mainInstance().loggingEnabled = false

Mixpanel.mainInstance().identify(distinctId: Mixpanel.mainInstance().distinctId)

The mixpanelToken and mixpanelInstanceName are two tokens. One in the US and the other in the EU as we were moving data between the countries according to EU law.

gfoldv avatar Sep 25 '23 11:09 gfoldv

Same issue in 4.1.4

sipersso avatar Oct 25 '23 12:10 sipersso

Hello, any update here? I updated the library and it the crash is still there...still the top crash in our app.

pmgsPT avatar Nov 03 '23 08:11 pmgsPT

Hi, we also updated to latest mixpanel build at your company and this crash appears in top-5 crashes even in small roll-out. We stopped release with trying to understand how to fix it

pavel-trafimuk avatar Nov 06 '23 06:11 pavel-trafimuk

Hey, same here. This is a top crash for us.

3a4oT avatar Nov 08 '23 08:11 3a4oT

Same issue on version 4.1.4 and also top crash for us

AminHeidariD avatar Jan 02 '24 13:01 AminHeidariD

Is it going to be fixed ever? We have 3-5 crashes everyday with it.

slipdef avatar Feb 26 '24 22:02 slipdef

@jaredmixpanel @zihejia how can we assist you to find the cause of the crash?

gfoldv avatar Mar 12 '24 19:03 gfoldv

hi @malcommac @gfoldv , the root cause of the crash was a race condition occurring when setting the server URL. We have addressed this issue in v4.2.6. I am closing this issue, but please feel free to reopen it if the problem persists.

zihejia avatar Apr 20 '24 03:04 zihejia