mastodon / mastodon-ios

Official iOS app for Mastodon
https://app.joinmastodon.org/ios
GNU General Public License v3.0
2.09k stars 269 forks source link

IOS client consistently hangs when writing new post at ~= 150 chars #705

Open jakemanion opened 1 year ago

jakemanion commented 1 year ago

Is there an existing issue for this?

Current Behavior

  1. Start new post or reply
  2. Start writing
  3. App consistently hangs when about 150 characters have been typed.
  4. App needs a restart to do anything else

The hang is odd - the carat is still flashing, but the keyboard gets stuck as per the attached image, and nothing is interactable.

204345127-1a756678-df1c-4c27-a490-613cdcf88ac5

Expected Behavior

It should allow writing until the full character limit

Steps To Reproduce

  1. On Mastodon for iOS v1.4.7 (199) on iPhone SE A2783 running iOS 15.4.1 (19E258)
  2. Start new post or reply
  3. Start writing until about150 characters

Environment

- Device: iPhone SE A2783
- OS: 15.4.1 (19E258)
- Version: Mastodon for iOS v1.4.7
- Build: 199

Anything else?

No response

LorenAmelang commented 1 year ago

Happens to me, too. "The Mastodon iOS app locked up every try when the count hit exactly 400! Had to be hard killed."

Again today: iPhone-2022 11 29-11 49 23 000

iOS 16.1.1, Mastodon 1.4.7 (199)

Is there any evidence I could collect and share?

j-f1 commented 1 year ago

If you have a Mac with Xcode installed, it would be awesome if you could capture a trace of the hang. Here’s how:

  1. Open Xcode
  2. Plug in your device and open the Mastodon app
  3. Select Xcode → Open Developer Tool → Instruments from the menu bar
  4. In the window that pops up, select Time Profiler.
  5. Select your iOS device in the left menu next to “Choose a profiling template for” and then choose the Mastodon app from the Running Applications section of the right menu. (It should have a number after its name, you can ignore the number)
  6. Click Choose.
  7. Click the record button in the top left.
  8. On your iPhone, reproduce the hang.
  9. Click the stop button in the top left after the hang has been happening for at least a few seconds.
  10. Save and upload the trace file.

This will help understand what code is running when you encounter the hang.

LorenAmelang commented 1 year ago

Sorry, no Mac here. Linux, Windows, iPad with Playgrounds, a-Shell and iSH...

jaredkrinke commented 1 year ago

This happens consistently to me as well on an iPhone SE (3rd gen). Is there any way to capture a trace or logs without a Mac that would be helpful?

ObviousDWest commented 1 year ago

Me too. Twice on a new post at exactly the same position. And once doing a reply. For your enjoyment: E73BFB70-D57D-47EE-B152-C9DCD4F92CA9

ObviousDWest commented 1 year ago

For me, this is caused by Display Zoom/Use Larger text in iOS settings. Disabling that makes longer posts possible. Reenabling it, I got the crash/hang again in about the same place. This is a newer iPhone SE.

jaredkrinke commented 1 year ago

I have (and have always had) that setting disabled, and I still consistently hit this hang on iPhone SE 3rd gen.

jaredkrinke commented 1 year ago

One thought: most of the reports here mention iPhone SE, and one mentions a "larger text" setting. Is there any chance this could be related to small screens or a small screen-to-font-size ratio?

j-f1 commented 1 year ago

If any of you have a Mac and are willing to temporarily install Xcode, my instructions in https://github.com/mastodon/mastodon-ios/issues/705#issuecomment-1333774273 would provide debugging info that would be super helpful for sorting out exactly why things are breaking.

thespianuk commented 1 year ago

If any of you have a Mac and are willing to temporarily install Xcode, my instructions in #705 (comment) would provide debugging info that would be super helpful for sorting out exactly why things are breaking.

Hi - have a trace here after replicating the issue - can you provide an alternative way of sharing this with the Mastodon App Devs and I'll send it across and am happy to provide anything else you need. I'm on mastodon.social as @marksemczyszyn

j-f1 commented 1 year ago

Thanks to @thespianuk’s trace, I’ve been able to track down the issue!

The relevant code seems to be at…

https://github.com/mastodon/mastodon-ios/blob/3e2282cb038b65d7695826442fcbe0d11bf1d066/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel%2BDataSource.swift#L36-L48

It seems like changing the composeContentTableViewCell frame may cause SwiftUI to re-layout and update the contentCellFrame height. One solution could be to do some filtering here to reduce the risk of an issue like this. Another solution could be dropping the UITableView being used here in favor of a fully SwiftUI view hierarchy (possibly with the scrolling handled by a UIScrollView because manually adjusting the scroll position of a ScrollView has caused me so. much. pain. in the past)

ridgekuhn commented 1 year ago

I'm also experiencing this issue on iPhone SE w iOS 15.7.1 and Mastodon app 1.4.9 build 224. Unfortunately, my Mac is on Catalina and the latest XCode I can run atm is v12, which doesn't seem to be able to profile my updated iPhone. Is there any other info I can provide that might help?

norlin commented 1 year ago

iPhone Xs here, consistently reproduced issue 100% of the time, related not to the text size, rather to lines amount. Freezes for me when text field goes to 5th line (could be just pressing Enter on each line).

d33pjs commented 1 year ago

Sadly, even after you workaround in #932, it's still freezing.

iOS: 16.3, Mastodon: 1.4.11

463D4B75-0496-441E-9B2C-0B46CF65D8E0

As you can see at the keyboard, it hangs just at the next key: "f".

update: because someone mentioned it: Im using a iPhone 14 Pro.

d33pjs commented 1 year ago

Ehm.... I just, can't reproduce it anymore. As you might suggest from my last post (https://github.com/mastodon/mastodon-ios/issues/705#issuecomment-1427132126)... it was easy to create an screenshot, because it freezes everytime.

And because @j-f1 couldn't reproduce it, I started tinkering. Here are some notes:

So, maybe someone could try if cleaning up the Media Cache could help (in mastodon app settings at the bottom) or switching to another account.

Im pretty new to mastodon, so I wasn't expecting something wrong with the Media Cache. Also because Im following like no one (2 people) - so my Timeline is pretty empty.

Hope that helps.

WhereCanI commented 1 year ago

This is also happening to me even after this new update that should have fixed the app from crashing when writing new posts.

image

MilkyEngineer commented 1 year ago

Confirming that it consistently hangs on v1.5 (286) on my iPhone 13 mini (A2628) using iOS 16.3.1 (20D67). I’ve got an old MacBook there to do an instrument check, so I’ll get around to doing a capture soon.

Edit: Have sent a Mastodon DM to @j-f1 with the trace and accompanying recording.

https://user-images.githubusercontent.com/7020632/226216804-ef6e707f-dc24-4a7c-9278-704a6cf88fad.MOV

Raphael-Hemme commented 1 year ago

I have the same issue each time I try to write a post or a response to someone else's post also at around 150 chars. On iPhone11 running iOS 16.4.1 and the Mastodon app v1.5.2.

jeanpaulrh commented 1 year ago

I just had this. I Rarely post on Mastodon so I forgot about it but it’s a while since I have this bug. iPhone 12 with latest iOS and larger text enabled under Settings -> Scren and Brightness-> Text size

salemXpresso commented 1 year ago

I had the same problem on my account but I realized the account I was logged in was @salemxpresso@salemxpresso@mastodon.top. After sign out and then sign in again without the name duplication, the issue disappeared. As the author of the issue seemed to have the same account name duplication, this might be our common configuration that causes the crash.

Raphael-Hemme commented 1 year ago

I had the same problem on my account but I realized the account I was logged in was @salemXpresso@salemxpresso@mastodon.top. After sign out and then sign in again without the name duplication, the issue disappeared. As the author of the issue seemed to have the same account name duplication, this might be our common configuration that causes the crash.

I can confirm that @salemXpresso 's solution of signing out (closing the app) and signing back in again did solve both of those issues for me as well. Thanks for sharing!

tigransimonyan commented 1 year ago

I have similar issue.

Steps To Reproduce:

  1. Open iPhone Settings -> Display & Brightness -> Display Zoom
  2. Choose "Large Text"
  3. Open Mastodon app
  4. Create new post
  5. Type something and press "return" 3 times
  6. App freezes and stops working

Environment:

TheAnnoyingFruit commented 1 year ago

I have the exact same issue. I do not have the name duplication glitch and have signed out and in and still suffer the same issue. iPhone 13 with iOS 17.1.1 and latest app version as of time of writing.

jaredkrinke commented 11 months ago

I had the same problem on my account but I realized the account I was logged in was @salemxpresso@salemxpresso@mastodon.top.

After sign out and then sign in again without the name duplication, the issue disappeared.

As the author of the issue seemed to have the same account name duplication, this might be our common configuration that causes the crash.

I don't have name duplication but I've been plagued by the issue ever since I installed the app.

Is the root cause understood yet? If not, is it possible the issue is related to the length of the user name?

Edit to add: signing out and back in did not help.

jaredkrinke commented 10 months ago

I think this is related to long user names.

Notice all the repro screenshots have a long user name that is truncated with an ellipsis. And the user with a duplicated name stopped hitting the issue after shortening their user name by removing the duplication.

I've always hit this issue with my account (also truncated), but when I created a new account with a short name, I'm no longer hitting hangs when typing out a large post! (Although I also switched servers since the server I was on had a super long domain, so the server domain could be related as well...)

@j-f1 if you're still able to help can you try with a long user name (or domain)?

Edit to add: I'm on Mastodon for iOS v2023.16 (6043), iPhone SE 3rd gen, iOS 17.1.2.