NCEAS / metacat

Data repository software that helps researchers preserve, share, and discover data
https://knb.ecoinformatics.org/software/metacat
GNU General Public License v2.0
25 stars 12 forks source link

Error when saving portal objects #1394

Closed laurenwalker closed 4 years ago

laurenwalker commented 4 years ago

I sometimes get an error response from Metacat when creating or updating portal objects. This tends to happen after metacat or metacat-index is updated. This is on the feature-project-indexing branch.

HTTP Status 500 – Internal Server ErrorType Exception ReportMessage Servlet execution threw an exceptionDescription The server encountered an unexpected condition that prevented it from fulfilling the request.Exceptionjavax.servlet.ServletException: Servlet execution threw an exception org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) edu.ucsb.nceas.metacat.restservice.D1URLFilter.doFilter(D1URLFilter.java:52) Root Causejava.lang.StackOverflowError org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source) org.apache.xerces.impl.xpath.regex.RegularExpression.matchString(Unknown Source)

When I try to save it again, I get the following error:

Error inserting or updating document: urn:uuid:ca40ae63-3079-45fe-b312-d87de933cd6b since Next revision number can't be less than or equal to 3
taojing2002 commented 4 years ago

It seems a bug in the old version of xcerces. See: https://issues.apache.org/jira/browse/XERCESJ-589 Someone on the above link said:

I've run across this problem in every version of xerces (that I've used) to date. Looking at the code for the matchString function, the problem appears to be the recursive nature of the function. No matter what size the stack is set to, you always run into this problem if you supply a large enough string to parse. This is due to the function pulling a chunk off of the parse string and recursively calling the function on the remainder. Given that a string could be any length (ie 10,000 characters or even more) thats a lot of recursive calls. The only real solution to this problem is to rewrite the function in an iterative form thus alleviating the excessive usage of the stack.

I upgraded the xerces version from 2.7.1 to 2.12.0. It works now.

laurenwalker commented 4 years ago

Great sleuthing, thanks Jing!

taojing2002 commented 4 years ago

You are welcome, Lauren. Thank you for you patience. On 10/17/19 12:33 PM, Lauren Walker wrote:

Great sleuthing, thanks Jing!

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/NCEAS/metacat/issues/1394?email_source=notifications&email_token=AB5QQDFB6PKJMEFFDVHHZ4LQPC4Z7A5CNFSM4I5GTQ62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBRINIQ#issuecomment-543327906, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5QQDENDT26VPKK4XTO6ULQPC4Z7ANCNFSM4I5GTQ6Q.