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

Clean up nextEffect pointer #16115

Merged
merged 1 commit into from Jul 18, 2019
Merged

Conversation

paulshen
Copy link
Contributor

This change clears the nextEffect reference when it is no longer needed. If there are no passive effects, we iterate through the effect chain after committing host/layout effects. Otherwise, we remove the pointer while flushing passive effects. Pulled from #15157

Without this change, it is possible for live Fiber nodes to have nextEffect pointers to unmounted Fiber nodes.

Repro

https://gist.github.com/paulshen/8a10c1ac7cd1b2983219e27a08d0f85b
Click "Increment" many times and notice that all unmounted <InnerBody> Fiber nodes are retained via a nextEffect chain from <Sidebar>'s Fiber node.

image

With this change, <Sidebar>'s Fiber node has an empty nextEffect reference.

@sizebot
Copy link

sizebot commented Jul 11, 2019

ReactDOM: size: 0.0%, gzip: 0.0%

Details of bundled changes.

Comparing: 3f1dee0...5f94d0f

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.1% +0.1% 628.14 KB 628.64 KB 137.93 KB 138.05 KB UMD_DEV
react-art.production.min.js 🔺+0.1% 0.0% 102.2 KB 102.28 KB 31.26 KB 31.28 KB UMD_PROD
react-art.development.js +0.1% +0.1% 559 KB 559.5 KB 120.55 KB 120.68 KB NODE_DEV
react-art.production.min.js 🔺+0.1% 🔺+0.1% 67.25 KB 67.33 KB 20.6 KB 20.63 KB NODE_PROD
ReactART-dev.js +0.1% +0.1% 572.1 KB 572.6 KB 120.15 KB 120.28 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.1% 🔺+0.1% 218.6 KB 218.88 KB 37.11 KB 37.16 KB FB_WWW_PROD

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.profiling.min.js +0.1% +0.1% 114.94 KB 115.01 KB 36.25 KB 36.28 KB NODE_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 135.74 KB 135.74 KB 35.81 KB 35.81 KB UMD_DEV
ReactDOM-dev.js +0.1% +0.1% 914.66 KB 915.17 KB 203.44 KB 203.57 KB FB_WWW_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 19.34 KB 19.34 KB 7.23 KB 7.23 KB UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 57.96 KB 57.96 KB 15.91 KB 15.91 KB UMD_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.78 KB 3.78 KB 1.52 KB 1.52 KB UMD_DEV
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.3% 1.21 KB 1.21 KB 704 B 706 B UMD_PROD
react-dom-test-utils.development.js 0.0% 0.0% 56.22 KB 56.22 KB 15.59 KB 15.59 KB NODE_DEV
react-dom-unstable-fizz.browser.development.js 0.0% +0.1% 3.61 KB 3.61 KB 1.47 KB 1.48 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% 0.0% 10.71 KB 10.71 KB 3.94 KB 3.94 KB NODE_PROD
react-dom-unstable-fizz.browser.production.min.js 0.0% 🔺+0.3% 1.05 KB 1.05 KB 635 B 637 B NODE_PROD
react-dom.development.js +0.1% +0.1% 891.93 KB 892.43 KB 203.04 KB 203.17 KB UMD_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 111.21 KB 111.31 KB 35.81 KB 35.83 KB UMD_PROD
react-dom.profiling.min.js +0.1% 0.0% 114.66 KB 114.74 KB 36.85 KB 36.86 KB UMD_PROFILING
react-dom.development.js +0.1% +0.1% 886.21 KB 886.72 KB 201.53 KB 201.66 KB NODE_DEV
react-dom-server.node.development.js 0.0% 0.0% 133.8 KB 133.8 KB 35.43 KB 35.43 KB NODE_DEV
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 111.29 KB 111.38 KB 35.32 KB 35.35 KB NODE_PROD
react-dom-server.node.production.min.js 0.0% 0.0% 20.11 KB 20.11 KB 7.54 KB 7.54 KB NODE_PROD
ReactDOM-prod.js 🔺+0.1% 🔺+0.1% 371.01 KB 371.53 KB 68.03 KB 68.09 KB FB_WWW_PROD
ReactDOM-profiling.js +0.1% 0.0% 377.34 KB 377.59 KB 69.37 KB 69.4 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 131.88 KB 131.88 KB 34.88 KB 34.88 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 19.26 KB 19.26 KB 7.24 KB 7.24 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.76 KB 60.76 KB 15.84 KB 15.85 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.74 KB 10.74 KB 3.68 KB 3.68 KB UMD_PROD
ReactDOMServer-dev.js 0.0% 0.0% 134.27 KB 134.27 KB 34.44 KB 34.45 KB FB_WWW_DEV
ReactDOMServer-prod.js 0.0% 0.0% 46.67 KB 46.67 KB 10.74 KB 10.74 KB FB_WWW_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 60.43 KB 60.43 KB 15.72 KB 15.72 KB NODE_DEV
react-dom-unstable-fizz.node.development.js 0.0% +0.1% 3.85 KB 3.85 KB 1.5 KB 1.5 KB NODE_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 🔺+0.1% 10.48 KB 10.48 KB 3.58 KB 3.58 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% 🔺+0.2% 1.1 KB 1.1 KB 666 B 667 B NODE_PROD

react-native-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactNativeRenderer-prod.js 🔺+0.1% 🔺+0.1% 272.23 KB 272.51 KB 46.78 KB 46.84 KB RN_OSS_PROD
ReactNativeRenderer-profiling.js +0.1% +0.1% 279.66 KB 280.05 KB 48.3 KB 48.34 KB RN_OSS_PROFILING
ReactFabric-prod.js 🔺+0.1% 🔺+0.1% 266.42 KB 266.7 KB 45.94 KB 45.99 KB RN_OSS_PROD
ReactFabric-profiling.js +0.1% +0.1% 274.43 KB 274.79 KB 47.36 KB 47.4 KB RN_OSS_PROFILING
ReactFabric-dev.js +0.1% +0.1% 720.66 KB 721.17 KB 153.42 KB 153.54 KB RN_FB_DEV
ReactFabric-prod.js 🔺+0.1% 🔺+0.1% 266.42 KB 266.7 KB 45.96 KB 46 KB RN_FB_PROD
ReactNativeRenderer-dev.js +0.1% +0.1% 707.09 KB 707.6 KB 150.8 KB 150.92 KB RN_OSS_DEV
ReactFabric-profiling.js +0.1% +0.1% 274.43 KB 274.79 KB 47.37 KB 47.41 KB RN_FB_PROFILING
ReactNativeRenderer-dev.js +0.1% +0.1% 707.19 KB 707.69 KB 150.85 KB 150.97 KB RN_FB_DEV
ReactNativeRenderer-prod.js 🔺+0.1% 🔺+0.1% 272.23 KB 272.51 KB 46.79 KB 46.85 KB RN_FB_PROD
ReactNativeRenderer-profiling.js +0.1% +0.1% 279.65 KB 280.04 KB 48.3 KB 48.35 KB RN_FB_PROFILING
ReactFabric-dev.js +0.1% +0.1% 720.56 KB 721.06 KB 153.37 KB 153.49 KB RN_OSS_DEV

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
ReactTestRenderer-dev.js +0.1% +0.1% 582.02 KB 582.52 KB 122.48 KB 122.61 KB FB_WWW_DEV
react-test-renderer-shallow.development.js 0.0% 0.0% 41.46 KB 41.46 KB 10.78 KB 10.79 KB UMD_DEV
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.66 KB 11.66 KB 3.56 KB 3.56 KB UMD_PROD
react-test-renderer-shallow.production.min.js 0.0% 0.0% 11.8 KB 11.8 KB 3.68 KB 3.68 KB NODE_PROD
react-test-renderer.development.js +0.1% +0.1% 571.35 KB 571.85 KB 123.23 KB 123.36 KB UMD_DEV
react-test-renderer.production.min.js 🔺+0.1% 🔺+0.1% 68.6 KB 68.68 KB 21.06 KB 21.09 KB UMD_PROD
react-test-renderer.development.js +0.1% +0.1% 566.89 KB 567.39 KB 122.08 KB 122.22 KB NODE_DEV
react-test-renderer.production.min.js 🔺+0.1% 🔺+0.1% 68.32 KB 68.4 KB 20.82 KB 20.84 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js +0.1% +0.1% 557.2 KB 557.7 KB 119.08 KB 119.21 KB NODE_DEV
react-reconciler.production.min.js 🔺+0.1% 🔺+0.1% 68.5 KB 68.58 KB 20.42 KB 20.44 KB NODE_PROD
react-reconciler-reflection.development.js 0.0% 0.0% 18.66 KB 18.66 KB 6.03 KB 6.03 KB NODE_DEV
react-reconciler-reflection.production.min.js 0.0% 🔺+0.3% 2.58 KB 2.58 KB 1.13 KB 1.13 KB NODE_PROD
react-reconciler-persistent.development.js +0.1% +0.1% 554.79 KB 555.29 KB 118.02 KB 118.15 KB NODE_DEV
react-reconciler-persistent.production.min.js 🔺+0.1% 🔺+0.1% 68.51 KB 68.59 KB 20.42 KB 20.45 KB NODE_PROD

Generated by 🚫 dangerJS

@sebmarkbage sebmarkbage merged commit b4178af into facebook:master Jul 18, 2019
@sebmarkbage
Copy link
Collaborator

Thanks @paulshen! Sorry about the long back and forth.

@gaearon
Copy link
Collaborator

gaearon commented Jul 30, 2019

We've published 0.0.0-db3ae32b8 of all packages, which includes this fix. It is likely to be a release candidate for 16.9.0. You can give it a try now and see whether it resolves the issue for you. Thanks.

@jonnycornwell
Copy link

👍 Thanks guys, finally got around to retesting and this definitely fixes the leak in the gatsby starter I made

@gaearon
Copy link
Collaborator

gaearon commented Aug 12, 2019

16.9 is out too.

This was referenced Mar 10, 2020
@sebmarkbage sebmarkbage mentioned this pull request May 4, 2020
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants