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

Lots of duplicate StackFrames during Checkin #1342

Open
muren400 opened this issue Dec 12, 2024 · 1 comment
Open

Lots of duplicate StackFrames during Checkin #1342

muren400 opened this issue Dec 12, 2024 · 1 comment

Comments

@muren400
Copy link
Contributor

muren400 commented Dec 12, 2024

Hi,

we have various IFC files created in Card/1 that repeatedly crashed our bimserver on checkin.

It seems like while traversing the ObjectPlacement query, QueryIncludeStackFrames for the same buildingstoreys are created again and again.

You can reproduce the behavior by importing this file.
I extracted a single Element from the original Model using BimPlusPlus.

For that example the server throws this exception:

'org.bimserver.BimserverDatabaseException: Query stack size > 10000000, probably a bug, please report

But we also had cases where the stack just grew until the bimserver froze completely. Maybe thats dependent on the model size and the amount of render engine processes?

One way this could be fixed is to remove this line from BimServer.java.

// The sole reason is to make sure this is done once, and then cached
objectPlacement.makeDirectRecursive(new HashSet<>());

But I'm pretty sure the fields where converted to direct fields for performance reasons?

Another way I found was to skip calling DatabaseReadingStackFrame.processPossibleIncludes() for objects that were already present in the cache. I could submit a pull request for that if you want me to.

Thanks,
BA

@hlg hlg added the reproduced label Dec 13, 2024
@hlg
Copy link
Member

hlg commented Dec 13, 2024

Interesting catch, thank you for reporting and providing such concise sample. I think the issue is with DatabaseReadingStackFrame indeed, but has nothing to do with the cache. It does processes the includes directly plus it pushes a QueryIncludeStackFrame to the stack processing queue, which in turn triggers processing of the same includes. In your example case this leads to deep recursion and an exponentially growing stack.

Also the setting of the direct fields seems to be done twice which is unnecessary but does not hurt as much.

I'll prepare a preliminary fix which keeps the QueryIncludeStackFrame and removes the direct processing of includes. Then, only FollowReferenceStackFrame is then skipped and processed directly for "direct" fields . After that I have to figure out whether it was the intention to also to remove the QueryIncludeStackFrame and if so how to properly implement this.

I think with this, we finally have the reason for #1230 which seems to be the same issue actually.

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

2 participants