newrelic / newrelic-ios-agent-spm

This repository hosts the Swift Package Manager deployment of the iOS agent
Apache License 2.0
15 stars 9 forks source link

Crash Payload.hpp line 19 in NewRelic::Connectivity::Payload::~Payload() #25

Closed AnshulMindbody closed 5 months ago

AnshulMindbody commented 1 year ago

^^ Payload.hpp line 19 in NewRelic::Connectivity::Payload::~Payload()^^

Description

App is crashing. Please check attached file for the crashlog.

Additional context

App-crashreport-03-28-2023_0317+0530.zip

gcazangi commented 1 year ago

After upgrading from 7.4.0 to 7.4.3 we got reports of similar crashes on New Relic SDK after letting the app on background and then opening the app:

#0  (null) in __pthread_kill ()
#1  (null) in pthread_kill ()
#2  (null) in abort ()
#3  (null) in malloc_vreport ()
#4  (null) in malloc_report ()
#5  (null) in find_zone_and_free ()
#6  0x00000001097d5380 in void std::__1::__libcpp_operator_delete<void*>(void*) ()
#7  0x00000001097d5380 in void std::__1::__do_deallocate_handle_size<>(void*, unsigned long) ()
#8  0x00000001097d5380 in std::__1::__libcpp_deallocate(void*, unsigned long, unsigned long) ()
#9  0x00000001097d5380 in std::__1::allocator<int>::deallocate(int*, unsigned long) ()
#10 0x00000001097d5380 in std::__1::allocator_traits<std::__1::allocator<int> >::deallocate(std::__1::allocator<int>&, int*, unsigned long) ()
#11 0x00000001097d5380 in std::__1::__vector_base<int, std::__1::allocator<int> >::~__vector_base() ()
#12 0x00000001097d5380 in std::__1::vector<int, std::__1::allocator<int> >::~vector() ()
#13 0x00000001097d5380 in std::__1::vector<int, std::__1::allocator<int> >::~vector() ()
#14 0x00000001097d5380 in NewRelic::Connectivity::Payload::~Payload() ()
#15 (null) in NewRelic::RequestEvent::RequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const> >, NewRe... ()
#16 (null) in NewRelic::EventManager::newRequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const> >, Ne... ()
#17 (null) in NewRelic::AnalyticsController::addRequestEvent(NewRelic::NetworkRequestData const&, NewRelic::NetworkResponseData const&, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::defau... ()
#18 0x00000001098019ac in -[NRMAAnalytics addNetworkRequestEvent:withResponse:withPayload:] ()
#19 0x0000000109813944 in __118+[NRMANetworkFacade noticeNetworkRequest:response:withTimer:bytesSent:bytesReceived:responseData:traceHeaders:params:]_block_invoke ()
#20 (null) in _dispatch_call_block_and_release ()
#21 (null) in _dispatch_client_callout ()
#22 (null) in _dispatch_queue_override_invoke ()
#23 (null) in _dispatch_root_queue_drain ()
#24 (null) in _dispatch_worker_thread2 ()
#25 (null) in _pthread_wqthread ()
#26 (null) in start_wqthread ()
#0  (null) in __pthread_kill ()
#1  (null) in pthread_kill ()
#2  (null) in abort ()
#3  (null) in malloc_vreport ()
#4  (null) in malloc_report ()
#5  (null) in find_zone_and_free ()
#6  0x0000000109061330 in void std::__1::__libcpp_operator_delete<void*>(void*) ()
#7  0x0000000109061330 in void std::__1::__do_deallocate_handle_size<>(void*, unsigned long) ()
#8  0x0000000109061330 in std::__1::__libcpp_deallocate(void*, unsigned long, unsigned long) ()
#9  0x0000000109061330 in std::__1::allocator<char>::deallocate(char*, unsigned long) ()
#10 0x0000000109061330 in std::__1::allocator_traits<std::__1::allocator<char> >::deallocate(std::__1::allocator<char>&, char*, unsigned long) ()
#11 0x0000000109061330 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string() ()
#12 0x0000000109061330 in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string() ()
#13 0x0000000109061330 in NewRelic::Connectivity::Payload::~Payload() ()
#14 (null) in NewRelic::RequestEvent::RequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const> >, NewRe... ()
#15 (null) in NewRelic::EventManager::newRequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const> >, Ne... ()
#16 (null) in NewRelic::AnalyticsController::addRequestEvent(NewRelic::NetworkRequestData const&, NewRelic::NetworkResponseData const&, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::defau... ()
#17 0x000000010908d9ac in -[NRMAAnalytics addNetworkRequestEvent:withResponse:withPayload:] ()
#18 0x000000010909f944 in __118+[NRMANetworkFacade noticeNetworkRequest:response:withTimer:bytesSent:bytesReceived:responseData:traceHeaders:params:]_block_invoke ()
#19 (null) in _dispatch_call_block_and_release ()
#20 (null) in _dispatch_client_callout ()
#21 (null) in _dispatch_queue_override_invoke ()
#22 (null) in _dispatch_root_queue_drain ()
#23 (null) in _dispatch_worker_thread2 ()
#24 (null) in _pthread_wqthread ()
#25 (null) in start_wqthread ()
Thread 18 name:   Dispatch queue: com.apple.root.default-qos
Thread 18 Crashed:
0   libsystem_kernel.dylib                 0x1d689b674 __pthread_kill + 8
1   libsystem_pthread.dylib                0x1e6fff1ac pthread_kill + 268
2   libsystem_c.dylib                      0x1a03fcc8c abort + 180
3   libsystem_malloc.dylib                 0x1a7287e2c malloc_vreport + 908
4   libsystem_malloc.dylib                 0x1a7288010 malloc_report + 64
5   libsystem_malloc.dylib                 0x1a7283918 find_zone_and_free + 308
6   NewRelic                               0x109ab5330 0x109aa8000 + 54064
7   NewRelic                               0x109b0e294 NewRelic::RequestEvent::RequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const> >, NewRelic::AttributeValidator&) + 160
8   NewRelic                               0x109b1caf0 NewRelic::EventManager::newRequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const> >, NewRelic::AttributeValidator&) + 56
9   NewRelic                               0x109b0a340 NewRelic::AnalyticsController::addRequestEvent(NewRelic::NetworkRequestData const&, NewRelic::NetworkResponseData const&, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const> >) + 200
10  NewRelic                               0x109ae19ac 0x109aa8000 + 235948
11  NewRelic                               0x109af3944 0x109aa8000 + 309572
12  libdispatch.dylib                      0x1a0397460 _dispatch_call_block_and_release + 32
13  libdispatch.dylib                      0x1a0398f88 _dispatch_client_callout + 20
14  libdispatch.dylib                      0x1a039c074 _dispatch_queue_override_invoke + 788
15  libdispatch.dylib                      0x1a03aaa6c _dispatch_root_queue_drain + 396
16  libdispatch.dylib                      0x1a03ab284 _dispatch_worker_thread2 + 164
17  libsystem_pthread.dylib                0x1e6ff8dbc _pthread_wqthread + 228
18  libsystem_pthread.dylib                0x1e6ff8b98 start_wqthread + 8
smalsam-newr commented 1 year ago

Thank you for your report. Would you please provide us with a list of other libraries you use, especially ones used for analytics and crash reporting, and how you initialize NewRelic in your AppDelegate?

AnshulMindbody commented 1 year ago

@smalsam-newr
In the didFinishLaunchingWithOptions [NewRelic startWithApplicationToken:"token"]; Other Analytics used - Pendo.

gcazangi commented 1 year ago

Also in didFinishLaunchingWithOptions, by calling startWithApplicationToken, the other tool we use is Sentry.

AnshulMindbody commented 1 year ago

There two places where the crashes are identified Payload.hpp line 19 in NewRelic::Connectivity::Payload::~Payload() string line 1459 in NewRelic::Connectivity::Payload::~Payload()

AliaksandrRegino commented 1 year ago

i also have a lot of crashes after updating to 7.4.3 string line 1459 in NewRelic::Connectivity::Payload::~Payload() Payload.hpp line 19 in NewRelic::Connectivity::Payload::~Payload()

dvshelley commented 1 year ago

New Relic says that 7.4.4 will release next week with a patch for this crash.

AnshulMindbody commented 1 year ago

@dvshelley issue is still happening in the newer version 7.4.4.

dvshelley commented 1 year ago

@AnshulMindbody We are also still seeing the crates on 7.4.4. We have an open support ticket with New Relic about it. They are still working on it and do not have a specific timeline yet for when the problem will be solved. I think we are going to roll back to 7.4.2 while we wait for the fix.

We didn't see these crashes when we were on 7.4.0, the last version we used prior to 7.4.3. Did anyone see these crashes on 7.4.2 or 7.4.1?

dvshelley commented 1 year ago

We tried 7.4.2. It also crashes. Ugh.

AnshulMindbody commented 1 year ago

@dvshelley yes you are correct issue is not happening on version 7.4.0.

kirkbig commented 1 year ago

we are also experiencing the crash in simulators using NewRelic v7.4.4 cc

#4  0x0000000103f6385c in NewRelic::Connectivity::Payload::~Payload() ()
#5  0x0000000103fc9348 in std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const> >::~unique_ptr() ()
#6  0x0000000103fc9200 in NewRelic::RequestEvent::RequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const> >, NewRelic::AttributeValidator&) ()
#7  0x0000000103ff9b6c in NewRelic::EventManager::newRequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const> >, NewRelic::AttributeValidator&) ()
#8  0x0000000103fbbe3c in NewRelic::AnalyticsController::addRequestEvent(NewRelic::NetworkRequestData const&, NewRelic::NetworkResponseData const&, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const> >) ()
#9  0x0000000103f9102c in -[NRMAAnalytics addNetworkRequestEvent:withResponse:withPayload:] ()
#10 0x0000000103fa2eb0 in __118+[NRMANetworkFacade noticeNetworkRequest:response:withTimer:bytesSent:bytesReceived:responseData:traceHeaders:params:]_block_invoke ()
kirkbig commented 1 year ago

4 0x0000000103f6385c in NewRelic::Connectivity::Payload::~Payload() ()

5 0x0000000103fc9348 in std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete >::~unique_ptr() ()

6 0x0000000103fc9200 in NewRelic::RequestEvent::RequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete >, NewRelic::AttributeValidator&) ()

7 0x0000000103ff9b6c in NewRelic::EventManager::newRequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete >, NewRelic::AttributeValidator&) ()

8 0x0000000103fbbe3c in NewRelic::AnalyticsController::addRequestEvent(NewRelic::NetworkRequestData const&, NewRelic::NetworkResponseData const&, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete >) ()

9 0x0000000103f9102c in -[NRMAAnalytics addNetworkRequestEvent:withResponse:withPayload:] ()

10 0x0000000103fa2eb0 in __118+[NRMANetworkFacade noticeNetworkRequest:response:withTimer:bytesSent:bytesReceived:responseData:traceHeaders:params:]_block_invoke ()

and this is happening quite frequently for us.

Ded77 commented 1 year ago

Same issue for us with version 7.4.3 and 7.4.4.

ajith-heb commented 1 year ago

Does any one know which version this issue has introduced? Is there any critical update that I may miss if I am downgrading SDK to 7.4.0 which was the last stable version integrated in our app?

larry-cariq commented 1 year ago

I just had this same crash for the first time on version 7.4.3:

Device Model:iPhone 8 Orientation:Face Up RAM free: 36.8 MB Disk free: 41.12 GB

Operating System Version:16.5.1 Orientation:Portrait Jailbroken:No

Crashed: com.apple.root.default-qos
SIGABRT ABORT 0x00000001fc5a9158

Crashed: com.apple.root.default-qos
0  libsystem_kernel.dylib         0x7158 __pthread_kill + 8
1  libsystem_pthread.dylib        0xd5f8 pthread_kill + 208
2  libsystem_c.dylib              0x1c4b8 abort + 124
3  libsystem_malloc.dylib         0x1d0b8 malloc_vreport + 904
4  libsystem_malloc.dylib         0x1d274 malloc_report + 60
5  libsystem_malloc.dylib         0x19788 find_zone_and_free + 292
6  NewRelic                       0xd380 NewRelic::Connectivity::Payload::~Payload() + 19 (Payload.hpp:19)
7  NewRelic                       0x66294 NewRelic::RequestEvent::RequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const>>, NewRelic::AttributeValidator&) + 160
8  NewRelic                       0x74af0 NewRelic::EventManager::newRequestEvent(unsigned long long, double, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const>>, NewRelic::AttributeValidator&) + 56
9  NewRelic                       0x62340 NewRelic::AnalyticsController::addRequestEvent(NewRelic::NetworkRequestData const&, NewRelic::NetworkResponseData const&, std::__1::unique_ptr<NewRelic::Connectivity::Payload const, std::__1::default_delete<NewRelic::Connectivity::Payload const>>) + 200
10 NewRelic                       0x399ac -[NRMAAnalytics addNetworkRequestEvent:withResponse:withPayload:] + 129 (NRMAAnalytics.mm:129)
11 NewRelic                       0x4b944 __118+[NRMANetworkFacade noticeNetworkRequest:response:withTimer:bytesSent:bytesReceived:responseData:traceHeaders:params:]_block_invoke + 315 (unique_ptr.h:315)
12 libdispatch.dylib              0x637a8 _dispatch_call_block_and_release + 24
13 libdispatch.dylib              0x64780 _dispatch_client_callout + 16
14 libdispatch.dylib              0x3b9f8 _dispatch_queue_override_invoke + 708
15 libdispatch.dylib              0x48c68 _dispatch_root_queue_drain + 328
16 libdispatch.dylib              0x49430 _dispatch_worker_thread2 + 160
17 libsystem_pthread.dylib        0x1b94 _pthread_wqthread + 224
18 libsystem_pthread.dylib        0x1720 start_wqthread + 8
rbarbish commented 1 year ago

Is this still happening for you all in 7.4.5? Currently using 7.4.3 and getting the crash at NewRelic::Connectivity::Payload::~Payload() + 1459. Thinking about downgrading to 7.4.0 if there is no support update on this.

dvshelley commented 1 year ago

Yes, the crashes still show in 7.4.5. We downgraded to 7.4.0 to work around the problem. 7.4.6 was just released today. The release notes do not mention this crash.

smalsam-newr commented 1 year ago

@dvshelley If you are still seeing this happen on 7.4.5, please contact support. We had not seen instances of this crash on 7.4.5.

NicolasEymael commented 7 months ago

any news on this? we are using NewRelic 7.4.8 and there are hundreds of crashes with different users, but i cant reproduce it

the log is a bit different (it says "noticeNetworkFailure" instead of "noticeNetworkRequest")

Crashed: com.apple.root.default-qos
0  CoreFoundation                 0x79b54 CFBasicHashGetBucket + 40
1  CoreFoundation                 0x848a0 CFBasicHashApply + 116
2  CoreFoundation                 0x854e8 CFDictionaryApplyFunction + 320
3  CFNetwork                      0x5bb44 _CFNetworkHTTPConnectionCacheSetLimit + 2564
4  CFNetwork                      0x1d4fc CFHTTPCookieCopyRequestHeaderFields + 3220
5  NewRelic                       0x57028 __62+[NRMANetworkFacade noticeNetworkFailure:withTimer:withError:]_block_invoke + 251 (NRMANetworkFacade.mm:251)
6  libdispatch.dylib              0x2320 _dispatch_call_block_and_release + 32
7  libdispatch.dylib              0x3eac _dispatch_client_callout + 20
8  libdispatch.dylib              0x6f8c _dispatch_queue_override_invoke + 788
9  libdispatch.dylib              0x15944 _dispatch_root_queue_drain + 396
10 libdispatch.dylib              0x16158 _dispatch_worker_thread2 + 164
11 libsystem_pthread.dylib        0xda0 _pthread_wqthread + 228
12 libsystem_pthread.dylib        0xb7c start_wqthread + 8
smalsam-newr commented 7 months ago

Try release 7.4.8, or just released 7.4.9. A new feature flag, NRFeatureFlag_NewEventSystem was added, which contains a rewrite to the event system which should eliminate the ~Payload() crash.

NicolasEymael commented 7 months ago

@smalsam-newr ok, i will deploy a new version using 7.4.9 with this feature flag if the crashes keep happening, i will reply here

ihnatmoisieiev commented 7 months ago

We're observing the same issue. Any working solution for now?

NicolasEymael commented 7 months ago

@smalsam-newr we found a new fatal error in our last version (using NewRelic 7.4.9 with NRFeatureFlag_NewEventSystem) do you have any idea how to fix it?

Crashed: com.apple.root.default-qos
0  libobjc.A.dylib                0x2c14 objc_retain + 16
1  libobjc.A.dylib                0x2c14 objc_retain_x0 + 16
2  NewRelic                       0x2c644 -[NRMAMobileEvent addAttribute:value:] + 50 (NRMAMobileEvent.m:50)
3  NewRelic                       0x410c8 -[NRMAAnalytics addRequestEvent:withResponse:withNRMAPayload:] + 323 (NRMAAnalytics.mm:323)
4  NewRelic                       0x550a4 __118+[NRMANetworkFacade noticeNetworkRequest:response:withTimer:bytesSent:bytesReceived:responseData:traceHeaders:params:]_block_invoke + 171 (NRMANetworkFacade.mm:171)
5  libdispatch.dylib              0x26a8 <redacted> + 32
6  libdispatch.dylib              0x4300 <redacted> + 20
7  libdispatch.dylib              0x744c <redacted> + 928
8  libdispatch.dylib              0x15be4 <redacted> + 392
9  libdispatch.dylib              0x163ec <redacted> + 156
10 libsystem_pthread.dylib        0x1928 _pthread_wqthread + 228
11 libsystem_pthread.dylib        0x1a04 start_wqthread + 8
cdillard-NewRelic commented 5 months ago

Please use the latest New Relic iOS agent 7.4.11 which contains a new feature flag, NRFeatureFlag_NewEventSystem. Enable this feature flag which should remove the ~Payload() crash.