Skip to content

[BUG]: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread. #4510

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

Open
rahulnainwalttn opened this issue Apr 10, 2025 · 2 comments
Labels

Comments

@rahulnainwalttn
Copy link

Version

6.11.0

What platforms are you having the problem on?

iOS

System Version

macOS 14.2.1 (23C71)

On what device are you experiencing the issue?

Real device

Architecture

New architecture with interop layer

What happened?

App become unresponsive and UI is getting black or app crash with this stack trace.

crashlytic log -

Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x2d5fc __exceptionPreprocess
1 libobjc.A.dylib 0x31244 objc_exception_throw
2 CoreAutoLayout 0x4ac8 _NSConstraintBasedLayoutDeferOptimization
3 CoreAutoLayout 0x4ea4 -[NSISEngine _optimizeWithoutRebuilding]
4 CoreAutoLayout 0x4dd4 -[NSISEngine optimize]
5 CoreAutoLayout 0x4b60 -[NSISEngine performPendingChangeNotifications]
6 UIKitCore 0x37e24 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
7 QuartzCore 0x90498 CA::Layer::layout_if_needed(CA::Transaction*)
8 QuartzCore 0x90024 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
9 QuartzCore 0xe50c4 CA::Context::commit_transaction(CA::Transaction*, double, double*)
10 QuartzCore 0x5bd8c CA::Transaction::commit()
11 QuartzCore 0x2342a8 CA::Transaction::release_thread(void*)
12 libsystem_pthread.dylib 0x4fc4 _pthread_tsd_cleanup
13 libsystem_pthread.dylib 0x4d34 _pthread_exit
14 libsystem_pthread.dylib 0x4ce0 _pthread_exit
15 libsystem_pthread.dylib 0x3708 _pthread_wqthread
16 libsystem_pthread.dylib 0x1474 start_wqthread

Image

Reproduction Link

repository link

Reproduction

Steps to reproduce this bug are: Use React-native version 0.77.1 along with react-native-video 6.11.0. Try to play content randomly with ads and PIP enabled.

Copy link

Thank you for your issue report. Please note that the following information is missing or incomplete:

  • reproduction link

Please update your issue with this information to help us address it more effectively.

Note: issues without complete information have a lower priority

There is a newer version of the library available. You are using version 6.11.0, while the latest stable version is 6.12.0. Please update to the latest version and check if the issue still exists.

Note: If the issue still exists, please update the issue report with the latest information.

@rahulnainwalttn
Copy link
Author

rahulnainwalttn commented Apr 14, 2025

Based upon my observation this is causing issues -

@objc
    func handleRotation() {
        DispatchQueue.main.async { [weak self] in
            guard let self else { return }

            self.setNeedsLayout()
            self.layoutIfNeeded()

            if let playerViewController = self._playerViewController {
                playerViewController.view.frame = UIScreen.main.bounds
                playerViewController.view.setNeedsLayout()
                playerViewController.view.layoutIfNeeded()

                // Update content overlay and subviews
                playerViewController.contentOverlayView?.frame = UIScreen.main.bounds
                for subview in playerViewController.contentOverlayView?.subviews ?? [] {
                    subview.frame = UIScreen.main.bounds
                }
            }
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: To Triage
Development

No branches or pull requests

1 participant