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 bug #79349: Unlinked anonymous classes prevent using preloading #5257

Closed
wants to merge 2 commits into from

Conversation

nikic
Copy link
Member

@nikic nikic commented Mar 11, 2020

Check the opcodes of preloaded classes for references to anonymous classes and force them to be linked. This prevents "Anonymous class wasn't preloaded" fatal errors at runtime.

This is a partial fix, because the same problem also exists for other dynamically declared classes. In that case the fix would be more complicated, as we would have to "link" the class but keep it under the RTD key, and then at runtime only do the bucket key change (or possibly, in this case, actually insert it as a new HT entry, as it would be hard to reset the bucket name after the request). Because of this I'm only fixing the more important anon class case for now.

@nikic nikic requested a review from dstogov March 11, 2020 15:49
@nikic
Copy link
Member Author

nikic commented Mar 11, 2020

I've pushed a second commit with a possible fix for the general dynamic class case.

One thing to note here is that these changes do require the deps of dynamically declared classes to exist, which may be problematic in some cases. The escape hatch is to make the dynamic declaration at the top level, not inside a function / method, then we won't preload it. I think that's what people already do anyway.

@nikic
Copy link
Member Author

nikic commented Mar 13, 2020

Closing this in favor of #5260.

@nikic nikic closed this Mar 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant