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

NullPointerException: org.wordpress.aztec.spans.AztecHeadingSpan in chooseHeight #18657

Closed
sentry-io bot opened this issue Jun 19, 2023 · 4 comments · Fixed by #19724
Closed

NullPointerException: org.wordpress.aztec.spans.AztecHeadingSpan in chooseHeight #18657

sentry-io bot opened this issue Jun 19, 2023 · 4 comments · Fixed by #19724

Comments

@sentry-io
Copy link

sentry-io bot commented Jun 19, 2023

Sentry Issue: JETPACK-ANDROID-XQ

NullPointerException: None
    at org.wordpress.aztec.spans.AztecHeadingSpan.chooseHeight(AztecHeadingSpan.kt:131)
    at android.text.StaticLayout.out(StaticLayout.java:953)
    at android.text.StaticLayout.generate(StaticLayout.java:863)
    at android.text.DynamicLayout.reflow(DynamicLayout.java:612)
    at android.text.DynamicLayout.generate(DynamicLayout.java:479)
...
(26 additional frame(s) were not displayed)
This was referenced Jun 28, 2023
@SiobhyB SiobhyB changed the title NullPointerException NullPointerException: org.wordpress.aztec.spans.AztecHeadingSpan in chooseHeight Jun 29, 2023
@SiobhyB
Copy link
Contributor

SiobhyB commented Jun 29, 2023

The first instance of this crash was seen in 20.5 (released on August 22nd, 2022). There were some height-related changes in Aztec around that time in wordpress-mobile/AztecEditor-Android#998 and wordpress-mobile/AztecEditor-Android#992. cc: @khaykov on the off-chance you may have an idea of what's causing this (I know Vojta's on leave).

The failure appears to happen at the chooseHeight function here:

https://github.com/wordpress-mobile/AztecEditor-Android/blob/b1f600a9ef80c7333ba190646db25899b633e793/aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecHeadingSpan.kt#L122-L162

I've, unfortunately, been unable to reproduce as of yet. I've made a few different attempts to update settings in a headings block.

Adding this to Maintenance Week Issue Board - React Native for us to potentially dig deeper into during a maintenance week.

@khaykov
Copy link
Member

khaykov commented Jun 29, 2023

@SiobhyB I checked Sentry and looks like we don't have this issue in Day One, where we use Aztec heavily. But we are not using it in React Native wrapper :) Looking at the code, I don't see any place where NPE can occur, unless some of the parameters coming into chooseHeight are null.

@SiobhyB SiobhyB self-assigned this Sep 14, 2023
@SiobhyB SiobhyB removed their assignment Sep 28, 2023
@sentry-io
Copy link
Author

sentry-io bot commented Oct 6, 2023

Sentry issue: WORDPRESS-ANDROID-2QDJ

@SiobhyB SiobhyB self-assigned this Nov 28, 2023
@SiobhyB
Copy link
Contributor

SiobhyB commented Dec 1, 2023

Sharing some findings from looking into this issue so far this week:

  • The first instance of this crash in the Jetpack app was 20.5, but the first instance in the WordPress app was 19.2.
  • Font size and line-height support was added for headings in 19.2 in [Mobile] - Enable font size and line height support and addresses Android issues WordPress/gutenberg#38205. As part of that, a change was made to the AztecHeadingSpan class in Heading Span - Reset previous font metrics if the font spacing changes AztecEditor-Android#952. It seems like any of these changes may have contributed to the crash.
  • From a sample of 20 events, I noticed the following commonalities:
    • Mostly happens on pages, though I also saw a couple of cases of this happening with posts.
    • Mixture of site types, including self-hosted, Jetpack-connected, Atomic, and simple WordPress.com.
    • Many of the crash events are preceded by warnings that indicate some issues with performance or network e.g. Timeout reached before response from requestGetHtml, NETWORK_CAPABILITIES_CHANGED, LOW_MEMORY, com.android.volley.ClientError.
    • Mainly happening with themes that don't support line-height or font size changes for headings. I also saw a few cases where users had very recently switched from themes that do support those settings (such as Twenty Twenty-Three) to themes that don't (like Hever).

I've emailed a few users directly to see if they may be willing to provide some insights on specific steps they took before the crash.

I'm a bit stumped on next steps, as I haven't been able to reproduce the crash. All the parameters coming into the chooseHeight are non-nullable, but maybe they're being set as null elsewhere in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants