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

Fix broken perf marker logging for RN > 0.58 on Android #23851

Closed

Conversation

karanjthakkar
Copy link
Contributor

Summary

Fixes #23771

Changelog

[Android] [Fixed] - Fix broken perf marker logging for RN > 0.58 on Android

Test Plan

The relevant markers are now logged whenever you initialise RN bridge.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 11, 2019
@react-native-bot react-native-bot added the Platform: Android Android applications. label Mar 11, 2019
@karanjthakkar
Copy link
Contributor Author

karanjthakkar commented Mar 11, 2019

The intention of this PR is not to be a final solution but to allow someone from FB to import this internally and see if it causes any regressions.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@axe-fb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@karanjthakkar
Copy link
Contributor Author

@axe-fb Do you have any updates from the result of importing this internally? There was a merge conflict that occurred from a recent change to master that I have now fixed as well.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@axe-fb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@axe-fb
Copy link
Contributor

axe-fb commented Mar 25, 2019

@karanjthakkar - I imported it internally, and looks like there are a ton of apps internally that use the old signature to initialize the JSC factory, causing compilation errors. Need to see if there is a way to change them all, or not add a new param to the constructor.

A side question - can this instead be a C++ module, instead of passing it in the constructor ?

@karanjthakkar
Copy link
Contributor Author

A side question - can this instead be a C++ module, instead of passing it in the constructor ?

@axe-fb I don't know what you mean by this. I'm not super well versed with the C++ architecture of RN. Do you have an example?

Need to see if there is a way to change them all, or not add a new param to the constructor.

The constructor technique was something Ben suggested in the original issue. I did not know internally folks create different JSC Factory. What is the usecase for that? Would overloading the constructor to allow zero arguments help?


Essentially I just want the metrics to work like they did before. There are already plans in place for v0.60 whereas this has been broken since v0.58. I'm happy to do whatever changes you think are appropriate to get this resolved. As you can see this has been sitting for quite some time and at some point it would get too difficult for me to resolve the conflicts that come from continuous updates to master. Its super unfortunate that this bug wasn't caught because they depend on different build systems for OSS and FB.

@@ -19,6 +20,7 @@ namespace {

class JSCExecutorFactory : public JSExecutorFactory {
public:
JSCExecutorFactory(ReactMarker::LogTaggedMarker logTaggedMarker) : logTaggedMarker_(logTaggedMarker) {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
JSCExecutorFactory(ReactMarker::LogTaggedMarker logTaggedMarker) : logTaggedMarker_(logTaggedMarker) {}
JSCExecutorFactory() { logTaggedMarker_ = nullptr; }
JSCExecutorFactory(ReactMarker::LogTaggedMarker logTaggedMarker) : logTaggedMarker_(logTaggedMarker) {}

@axe-fb Maybe something like this? Assuming the other instances of JSC factory that you are talking about don't need marker logging.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I was thinking we could have a second constructor, which would be hte original signature and hence existing apps will not break.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@axe-fb I can make that change but I wonder if that would be enough. This change would not break those features but again it will swallow any marker logs from the features because the logger won't be available. Do you think that would create any problems?

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@axe-fb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@karanjthakkar
Copy link
Contributor Author

FYI, test_android job is failing on master as well. So I assume it's unrelated to this PR.

@karanjthakkar
Copy link
Contributor Author

@axe-fb @mhorowitz Do you folks have any update here? Anything I can do to get this to resolution faster?

@@ -112,9 +112,9 @@ static void notifyAboutModuleSetup(RCTPerformanceLogger *performanceLogger, cons
}
}

static void registerPerformanceLoggerHooks(RCTPerformanceLogger *performanceLogger) {
static ReactMarker::LogTaggedMarker registerPerformanceLoggerHooks(RCTPerformanceLogger *performanceLogger) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment from @mhorowitz

This is also a strange name, since it's not "registering" anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made it getPerformanceLoggerHooks now. Let me know if that's okay.

@karanjthakkar karanjthakkar force-pushed the fix_react_markers branch 2 times, most recently from 8d1a7a6 to 319d2da Compare April 25, 2019 10:51
@@ -15,6 +15,10 @@ namespace react {

class JSCExecutorFactory : public JSExecutorFactory {
public:
explicit JSCExecutorFactory(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is needed to make the RNTester turbo module example work.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@axe-fb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@karanjthakkar
Copy link
Contributor Author

@axe-fb Do you have any updates here? Did the internal tests pass?

@axemclion
Copy link
Contributor

Sorry, did not mean change the constructor of JSCExecutor. Meant change JSIExecutor. Never mind though. I have made the changes, and am now trying to get it building internally.

@axe-fb
Copy link
Contributor

axe-fb commented May 10, 2019

So internal tests succeed, but OSS tests are failing !!

xplat/js/react-native-github/RNTester/RNTester/AppDelegate.mm:139:15: note: in instantiation of function template specialization 'std::__1::make_unique<facebook::react::JSCExecutorFactory, (lambda at xplat/js/react-native-github/RNTester/RNTester/AppDelegate.mm:139:64)>' requested here
  return std::make_unique<facebook::react::JSCExecutorFactory>([weakSelf, bridge](facebook::jsi::Runtime &runtime) {
       

now working on fixing those !!

This is indeed a game of whack-a-mole !! But atleast, we have good tests to catch these !!

@karanjthakkar
Copy link
Contributor Author

Yay! That's great! If you could push the commit here that you did to fix internal tests, I can try to look into why the oss tests are failing.

@axe-fb
Copy link
Contributor

axe-fb commented May 12, 2019

Update: I fixed all internal and OSS tests, so I think we should be good. I am now waiting for internal code review now, since the commit now has grown to touch a lot more files now.

@karanjthakkar
Copy link
Contributor Author

@axe-fb Thanks for the update! Look forward to seeing this resolved!

@karanjthakkar
Copy link
Contributor Author

@axe-fb Any update here? 🙂

@karanjthakkar karanjthakkar deleted the fix_react_markers branch December 18, 2020 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Platform: Android Android applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance markers logged from C++ no longer work in Android
6 participants