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

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

Open
1 task done
jakemanion opened this issue Nov 29, 2022 · 25 comments
Open
1 task done

Comments

@jakemanion
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

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
Copy link

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
Copy link
Contributor

j-f1 commented Dec 1, 2022

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
Copy link

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

@jaredkrinke
Copy link

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
Copy link

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
Copy link

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
Copy link

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

@jaredkrinke
Copy link

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
Copy link
Contributor

j-f1 commented Dec 16, 2022

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.

@thespianuk
Copy link

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
Copy link
Contributor

j-f1 commented Dec 22, 2022

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

The relevant code seems to be at…

$contentCellFrame
.map { $0.height }
.removeDuplicates()
.sink { [weak self] height in
guard let self = self else { return }
guard !tableView.visibleCells.isEmpty else { return }
UIView.performWithoutAnimation {
tableView.beginUpdates()
self.composeContentTableViewCell.frame.size.height = height
tableView.endUpdates()
}
}
.store(in: &disposeBag)

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)

@zeitschlag zeitschlag added the Bug Something isn't working label Dec 26, 2022
@ridgekuhn
Copy link

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
Copy link

norlin commented Jan 19, 2023

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
Copy link

d33pjs commented Feb 12, 2023

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
Copy link

d33pjs commented Feb 12, 2023

Ehm.... I just, can't reproduce it anymore. As you might suggest from my last post (#705 (comment))... 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:

  • In general I have 2 Accounts added to the Mastodon App
    • 1 well-known public server, 1 privat server
  • I just emtied the media cache
  • Removed the privat server account
  • Then I tested the freez on the "public server" and... nothing. It worked: I can write as much as I want and there is no freez (sadly, I didn't tested it directly after I cleaned the media cache)
  • Re-added the privat server account and... can't reproduce the error there anymore. Can also write as much as I want now - on both accounts. Even after restarting the App.

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
Copy link

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
Copy link

MilkyEngineer commented Mar 19, 2023

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.

IMG_1128.MOV

@Raphael-Hemme
Copy link

Raphael-Hemme commented May 1, 2023

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
Copy link

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
Copy link

salemXpresso commented Jul 14, 2023

I had the same problem on my account but I realized the account I was logged in was @salemXpresso@[email protected].
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
Copy link

I had the same problem on my account but I realized the account I was logged in was @salemXpresso@[email protected].
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
Copy link

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:

  • Device: iPhone 10
  • OS: 16.7.1
  • Version: 2023.13
  • Build: 348

@TheAnnoyingFruit
Copy link

TheAnnoyingFruit commented Nov 24, 2023

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
Copy link

jaredkrinke commented Dec 21, 2023

I had the same problem on my account but I realized the account I was logged in was @salemXpresso@[email protected].

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
Copy link

jaredkrinke commented Jan 15, 2024

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.

@whattherestimefor whattherestimefor modified the milestones: 2024.11, To Do Nov 20, 2024
@whattherestimefor whattherestimefor modified the milestones: To Do, 2024.12 Dec 10, 2024
whattherestimefor added a commit that referenced this issue Dec 16, 2024
Using global background queue was handing the character counting work to a different thread every time the text changed. Forcing it always onto the same background queue would be another option, but main seems to feel fast enough and is safer because of all the view-related things downstream.

Contributes to #705 IOS client consistently hangs when writing new post at ~= 150 chars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests