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

[BUG] NPE thrown on frequent updates of an XML resource #5273

Closed
line-o opened this issue Apr 9, 2024 · 1 comment
Closed

[BUG] NPE thrown on frequent updates of an XML resource #5273

line-o opened this issue Apr 9, 2024 · 1 comment
Assignees
Labels
bug issue confirmed as bug high prio regression
Milestone

Comments

@line-o
Copy link
Member

line-o commented Apr 9, 2024

Description:

Frequent updates on any XML resource stored in the database will cause a NullPointerException when it hits the fragmentation limit.

update replace $stored-node with $new-node

This will result in

  1. the document effectively being removed from the database
  2. the data of that document to be no longer present in any configured index

Reference:

Affected versions 6.1.0 and later (6.2.0, 6.3.0-SNAPSHOT, 7.0.0-SNAPSHOT)
Regression introduced in c553667

Type of tests:

Evaluate following query

xquery version "3.1";

(:sm:create-account("test", "test", "test"),:)
(:sm:create-group("test"),:)
xmldb:create-collection("/db", "test"),
sm:chgrp(xs:anyURI("/db/test"), "test"),
sm:chmod(xs:anyURI("/db/test"), "rwxrws---"),
xmldb:store("/db/test", "test.xml", <test><foo/></test>),
sm:chmod(xs:anyURI("/db/test/test.xml"), "rw-rw----"),
xmldb:create-collection("/db/apps", "test"),
sm:chmod(xs:anyURI("/db/apps/test"), "rwxrwxrwx"),
xmldb:store("/db/apps/test", "update.xql", "update replace doc('/db/test/test.xml')/test/foo with <foo updated='{util:system-time()}' />, doc('/db/test/test.xml')/test/foo", "application/xquery"),
sm:chown(xs:anyURI("/db/apps/test/update.xql"), "test"),
sm:chgrp(xs:anyURI("/db/apps/test/update.xql"), "test"),
sm:chmod(xs:anyURI("/db/apps/test/update.xql"), "rwxr-sr-x")

Then open /exist/apps/test/update.xql as guest

@joewiz joewiz added the bug issue confirmed as bug label Apr 9, 2024
@joewiz joewiz added this to the eXist-6.2.1 milestone Apr 9, 2024
line-o added a commit to line-o/exist that referenced this issue Apr 11, 2024
By setting the allowed-fragmentation attribute value to -1 any
modification will trigger the defragmentation of the structural(?) index (AKA BTree).

This setting triggers the NPE described in eXist-db#5273 on the very first call to

update (replace|insert)

Unfortunately, it also triggers a totally different class of NPEs in
XQueryTrigger and other subsystems of the database.
@dizzzz dizzzz closed this as completed Apr 29, 2024
@line-o line-o reopened this Jul 3, 2024
@line-o
Copy link
Member Author

line-o commented Jul 3, 2024

Reopened until fixed in 6.x.x #5296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue confirmed as bug high prio regression
Projects
None yet
Development

No branches or pull requests

4 participants