Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v6.6.0 #2042

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
baadae6
feat(correlation): added the trace correlation property to the Event …
lemnik Apr 25, 2024
187e954
Merge pull request #2023 from bugsnag/PLAT-12049/correlation-event-model
lemnik Apr 29, 2024
b00e1b8
Merge pull request #2029 from bugsnag/master
lemnik May 16, 2024
084df8b
Add Android 14 tests
twometresteve May 15, 2024
950d5a2
Merge branch 'next' into tms/android-14
twometresteve May 18, 2024
c61bd2b
Merge pull request #2032 from bugsnag/tms/android-14
twometresteve May 21, 2024
df65b5f
refactor(ndk): added BSG_KSJSONCodec to the NDK plugin
lemnik May 1, 2024
6c59e8f
refactor(ndk): add simplified ISO 8601 time formatting to BSG_KSCrash…
lemnik May 2, 2024
7681abf
refactor(ndk): rewrote the event_writer.c to output JSON instead of a…
lemnik May 2, 2024
481b0de
refactor(ndk): removed old binary-dump event logic & added a new test…
lemnik May 9, 2024
6d74432
fix(ndk): fixed a bug where the breadcrumb metadata was double-nested
lemnik May 9, 2024
6f06a86
fix(ndk): moved the NDK JSON payloads back to their own directory so …
lemnik May 9, 2024
a1882f6
fix(ndk): BugsnagEventMapper now handles date formats in the "t{epoch…
lemnik May 13, 2024
dd2f56a
fix(ndk): added thread.type to ndk events, and removed invalid / paus…
lemnik May 13, 2024
09751aa
fix(ndk): fixed NDK thread writing behaviour
lemnik May 13, 2024
ece1825
fix(ndk): added the static usage metrics data to the native events
lemnik May 14, 2024
0abb887
test(ndk): added a basic ReportDiscardScanner test
lemnik May 15, 2024
6c17539
refactor(ndk event): replaced STRING_**_EMPTY macros with inline func…
lemnik May 21, 2024
74b6001
refactor(ndk event): copy the entire event_path instead of relying on…
lemnik May 21, 2024
3161e39
refactor(ndk event): NaN & Inf values are encoded to JSON as 'null'
lemnik May 22, 2024
308c95f
Merge pull request #2027 from bugsnag/PLAT-12009/json-event
lemnik May 22, 2024
6c29641
Update AGP and related versions for mazerunner (#2030)
YYChen01988 May 22, 2024
9f62d7a
fix(Session Tracker) fixed logic of discarding session (#2033)
YYChen01988 May 24, 2024
5bc8d99
fix(errorCallback) separating throw exception out (#2036)
YYChen01988 May 31, 2024
2201a50
refactor(ndk event): iterate directly over metadata elements in NDK i…
lemnik May 30, 2024
9a6104c
test(ndk): fixed event_serialization.json to align with the expected …
lemnik May 30, 2024
af3f5bc
test(ndk): manually cause a stack-overflow in CXXStackoverflowScenari…
lemnik May 30, 2024
2cce055
Merge pull request #2035 from bugsnag/PLAT-12075/ndk-metadata-iterator
lemnik Jun 4, 2024
d5ac07d
Reinstate instrumentation tests using MacOS test boxes as a platform …
Cawllec Jun 6, 2024
843bdb7
Merge branch 'next' into integration/error-correlation
lemnik Jun 12, 2024
5040101
feat(native): support kernels running with a 16kB page size
lemnik Jun 13, 2024
341930e
feat(event correlation): changed the casing of the `traceid`->`traceI…
lemnik Jun 13, 2024
e87cc38
Merge pull request #2040 from bugsnag/PLAT-12268/16kb-page-support
lemnik Jun 13, 2024
e7eaf36
Merge branch 'next' into integration/error-correlation
lemnik Jun 13, 2024
1f49c06
chore(changelog): fixed the CHANGELOG entry for PR#2040
lemnik Jun 13, 2024
02dfd6e
Merge pull request #2038 from bugsnag/integration/error-correlation
lemnik Jun 13, 2024
e8d6bdc
release/v6.6.0
YYChen01988 Jun 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,79 +1 @@
{
"context": "Foo",
"metaData": {},
"severity": "info",
"unhandled": true,
"severityReason": {
"unhandledOverridden": false,
"type": "signal",
"attributes": {
"signalType": "SIGSEGV"
}
},
"exceptions": [
{
"errorClass": "SIGSEGV",
"message": "Whoops!",
"type": "c",
"stacktrace": [
{
"frameAddress": "0x0",
"symbolAddress": "0x0",
"loadAddress": "0x0",
"lineNumber": 58,
"isPC": true,
"file": "Something.c",
"method": "foo()"
}
]
}
],
"user": {
"id": "123",
"name": "Bob Bobbiton",
"email": "bob@example.com"
},
"app": {
"version": "1.0",
"id": "fa02",
"type": "C",
"releaseStage": "dev",
"versionCode": 55,
"buildUUID": "123",
"binaryArch": "x86",
"duration": 9019,
"durationInForeground": 7017,
"inForeground": true,
"isLaunching": true
},
"device": {
"osName": "android",
"id": "my-id-123",
"locale": "en",
"osVersion": "9.1",
"manufacturer": "Google",
"model": "Nexus",
"orientation": "portrait",
"runtimeVersions": {
"androidApiLevel": 0,
"osBuild": ""
},
"cpuAbi": [],
"totalMemory": 1095092340,
"jailbroken": true,
"time": "1970-01-01T02:06:49Z"
},
"breadcrumbs": [],
"groupingHash": "Bar",
"usage": {
"callbacks": {}
},
"session": {
"id": "",
"startedAt": "",
"events": {
"handled": 0,
"unhandled": 0
}
}
}
{"context":"Foo","metaData":{},"severity":"info","unhandled":true,"severityReason":{"unhandledOverridden":false,"type":"signal","attributes":{"signalType":"SIGSEGV"}},"exceptions":[{"errorClass":"SIGSEGV","message":"Whoops!","type":"c","stacktrace":[{"frameAddress":"0x0","symbolAddress":"0x0","loadAddress":"0x0","lineNumber":58,"isPC":true,"file":"Something.c","method":"foo()"}]}],"user":{"id":"123","name":"Bob Bobbiton","email":"bob@example.com"},"app":{"version":"1.0","id":"fa02","type":"C","releaseStage":"dev","versionCode":55,"buildUUID":"123","binaryArch":"x86","duration":9019,"durationInForeground":7017,"inForeground":true,"isLaunching":true},"device":{"osName":"android","id":"my-id-123","locale":"en","osVersion":"9.1","manufacturer":"Google","model":"Nexus","orientation":"portrait","runtimeVersions":{"androidApiLevel":0,"osBuild":""},"cpuAbi":[],"totalMemory":1095092340,"jailbroken":true,"time":"1970-01-01T02:06:49Z"},"breadcrumbs":[],"groupingHash":"Bar","usage":{"callbacks":{}},"threads":[]}
210 changes: 77 additions & 133 deletions bugsnag-plugin-android-ndk/src/main/jni/metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,101 +376,71 @@ static void populate_metadata_value(JNIEnv *env, bugsnag_metadata *dst,
}

static void populate_metadata_obj(JNIEnv *env, bugsnag_metadata *dst,
jobject section, jobject section_keylist,
int index) {
jstring section_key = NULL;
const char *name = NULL;
jobject _value = NULL;

if (!bsg_jni_cache->initialized) {
goto exit;
}

section_key = bsg_safe_call_object_method(
env, section_keylist, bsg_jni_cache->ArrayList_get, (jint)index);
if (section_key == NULL) {
goto exit;
}
const char *section, jobject section_map) {
jobject entryset = NULL;
jobject entries = NULL;

_value = bsg_safe_call_object_method(env, section, bsg_jni_cache->Map_get,
section_key);
name = bsg_safe_get_string_utf_chars(env, section_key);
if (name == NULL) {
if (section_map == NULL) {
goto exit;
}

populate_metadata_value(env, dst, section, name, _value);

exit:
bsg_safe_release_string_utf_chars(env, section_key, name);
bsg_safe_delete_local_ref(env, section_key);
bsg_safe_delete_local_ref(env, _value);
}

static void populate_metadata_section(JNIEnv *env, bugsnag_metadata *dst,
jobject metadata, jobject keylist,
int i) {
jstring _key = NULL;
const char *section = NULL;
jobject _section = NULL;
jobject section_keyset = NULL;
jobject section_keylist = NULL;

if (!bsg_jni_cache->initialized) {
goto exit;
}

_key = bsg_safe_call_object_method(env, keylist, bsg_jni_cache->ArrayList_get,
(jint)i);
if (_key == NULL) {
goto exit;
}
section = bsg_safe_get_string_utf_chars(env, _key);
if (section == NULL) {
goto exit;
}
_section =
bsg_safe_call_object_method(env, metadata, bsg_jni_cache->Map_get, _key);
if (_section == NULL) {
// get size of metadata map
jint map_size =
bsg_safe_call_int_method(env, section_map, bsg_jni_cache->Map_size);
if (map_size <= 0) {
goto exit;
}
jint section_size =
bsg_safe_call_int_method(env, _section, bsg_jni_cache->Map_size);
if (section_size == -1) {

// create a list of metadata keys
entryset = bsg_safe_call_object_method(env, section_map,
bsg_jni_cache->Map_entrySet);
if (entryset == NULL) {
goto exit;
}
section_keyset =
bsg_safe_call_object_method(env, _section, bsg_jni_cache->Map_keySet);
if (section_keyset == NULL) {
entries =
bsg_safe_call_object_method(env, entryset, bsg_jni_cache->Set_iterator);
if (entries == NULL) {
goto exit;
}

section_keylist = bsg_safe_new_object(
env, bsg_jni_cache->ArrayList,
bsg_jni_cache->ArrayList_constructor_collection, section_keyset);
if (section_keylist == NULL) {
goto exit;
}
for (int j = 0; j < section_size; j++) {
populate_metadata_obj(env, dst, _section, section_keylist, j);
// we iterate against the size of the Map, avoiding calling Iterator.hasNext()
// on each loop (avoiding the small JNI overhead). Any concurrent modification
// will be caught as an exception and handled by bsg_safe_call_object_method
for (int i = 0; i < map_size; i++) {
(*env)->PushLocalFrame(env, 3);
{
jobject entry = bsg_safe_call_object_method(env, entries,
bsg_jni_cache->Iterator_next);
jstring _key = bsg_safe_call_object_method(
env, entry, bsg_jni_cache->MapEntry_getKey);
jobject _value = bsg_safe_call_object_method(
env, entry, bsg_jni_cache->MapEntry_getValue);

if (_key != NULL && _value != NULL) {
const char *key = bsg_safe_get_string_utf_chars(env, _key);
if (key != NULL) {
populate_metadata_value(env, dst, section, key, _value);
bsg_safe_release_string_utf_chars(env, _key, key);
}
}
}
(*env)->PopLocalFrame(env, NULL);
}
goto exit;

exit:
bsg_safe_release_string_utf_chars(env, _key, section);
bsg_safe_delete_local_ref(env, _key);
bsg_safe_delete_local_ref(env, _section);
bsg_safe_delete_local_ref(env, section_keyset);
bsg_safe_delete_local_ref(env, section_keylist);
bsg_safe_delete_local_ref(env, entries);
bsg_safe_delete_local_ref(env, entryset);
}

// Internal API

void bsg_populate_metadata(JNIEnv *env, bugsnag_metadata *dst,
jobject metadata) {
jobject _metadata = NULL;
jobject keyset = NULL;
jobject keylist = NULL;
jobject entrySet = NULL;
jobject entryIterator = NULL;

if (!bsg_jni_cache->initialized) {
goto exit;
Expand All @@ -489,90 +459,64 @@ void bsg_populate_metadata(JNIEnv *env, bugsnag_metadata *dst,
}

int size = bsg_safe_call_int_method(env, metadata, bsg_jni_cache->Map_size);
if (size == -1) {
if (size <= 0) {
goto exit;
}

// create a list of metadata keys
keyset = bsg_safe_call_static_object_method(env, metadata,
bsg_jni_cache->Map_keySet);
if (keyset == NULL) {
// retrieve the Map.Entry set
entrySet =
bsg_safe_call_object_method(env, metadata, bsg_jni_cache->Map_entrySet);
if (entrySet == NULL) {
goto exit;
}
keylist = bsg_safe_new_object(env, bsg_jni_cache->ArrayList,
bsg_jni_cache->ArrayList_constructor_collection,
keyset);
if (keylist == NULL) {

// retrieve an Iterator<Map.Entry>
entryIterator =
bsg_safe_call_object_method(env, entrySet, bsg_jni_cache->Set_iterator);
if (entryIterator == NULL) {
goto exit;
}

// we iterate against the size of the Map, avoiding calling Iterator.hasNext()
// on each loop (avoiding the small JNI overhead). Any concurrent modification
// will be caught as an exception and handled by bsg_safe_call_object_method
for (int i = 0; i < size; i++) {
populate_metadata_section(env, dst, metadata, keylist, i);
(*env)->PushLocalFrame(env, 3);
{
jobject entry = bsg_safe_call_object_method(env, entryIterator,
bsg_jni_cache->Iterator_next);
jobject _key = bsg_safe_call_object_method(
env, entry, bsg_jni_cache->MapEntry_getKey);
jobject _value = bsg_safe_call_object_method(
env, entry, bsg_jni_cache->MapEntry_getValue);

const char *section_name = bsg_safe_get_string_utf_chars(env, _key);

if (section_name != NULL && _value != NULL) {
populate_metadata_obj(env, dst, section_name, _value);
bsg_safe_release_string_utf_chars(env, _key, section_name);
}
}
(*env)->PopLocalFrame(env, NULL);
}

exit:
bsg_safe_delete_local_ref(env, _metadata);
bsg_safe_delete_local_ref(env, keyset);
bsg_safe_delete_local_ref(env, keylist);
bsg_safe_delete_local_ref(env, entrySet);
bsg_safe_delete_local_ref(env, entryIterator);
}

void bsg_populate_crumb_metadata(JNIEnv *env, bugsnag_breadcrumb *crumb,
jobject metadata) {
jobject entryset = NULL;
jobject entries = NULL;

if (metadata == NULL) {
goto exit;
return;
}
if (!bsg_jni_cache->initialized) {
goto exit;
}

// get size of metadata map
jint map_size =
bsg_safe_call_int_method(env, metadata, bsg_jni_cache->Map_size);
if (map_size <= 0) {
goto exit;
}

// create a list of metadata keys
entryset =
bsg_safe_call_object_method(env, metadata, bsg_jni_cache->Map_entrySet);
if (entryset == NULL) {
goto exit;
}
entries =
bsg_safe_call_object_method(env, entryset, bsg_jni_cache->Set_iterator);
if (entries == NULL) {
goto exit;
}

while (bsg_safe_call_boolean_method(env, entries,
bsg_jni_cache->Iterator_hasNext)) {
(*env)->PushLocalFrame(env, 3);
{
jobject entry = bsg_safe_call_object_method(env, entries,
bsg_jni_cache->Iterator_next);
jstring _key = bsg_safe_call_object_method(
env, entry, bsg_jni_cache->MapEntry_getKey);
jobject _value = bsg_safe_call_object_method(
env, entry, bsg_jni_cache->MapEntry_getValue);

if (_key != NULL && _value != NULL) {
const char *key = bsg_safe_get_string_utf_chars(env, _key);
if (key != NULL) {
populate_metadata_value(env, &crumb->metadata, "metaData", key,
_value);
bsg_safe_release_string_utf_chars(env, _key, key);
}
}
}
(*env)->PopLocalFrame(env, NULL);
return;
}

exit:
bsg_safe_delete_local_ref(env, entries);
bsg_safe_delete_local_ref(env, entryset);
populate_metadata_obj(env, &crumb->metadata, "metaData", metadata);
}

void bsg_populate_event(JNIEnv *env, bugsnag_event *event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
extern "C" {
int __attribute__((optnone)) __attribute__((noinline)) crash_stack_overflow(int counter, char *input) {
char stack[7];
char *output = stack;

strcpy(stack, input);
while (*input) {
*output = *input;
input++;
output++;
}

return 4 / counter;
}
Expand Down
Loading