Faulty Filter causes internal server error or prevents JIRA Agile from upgrading
症状
Symptom #1
When viewing the favorite filter gadget, the following error appears:
atlassian-jira.log
に次のメッセージが表示される。
2013-02-26 10:53:09,551 xxx-xxx-8011-exec-8 ERROR [500ErrorPage.jsp] Exception caught in 500 page com.atlassian.jira.jql.parser.JqlParseException: com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: MismatchedSetException(46!=null)
com.atlassian.jira.exception.DataAccessException: com.atlassian.jira.jql.parser.JqlParseException: com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: MismatchedSetException(46!=null)
at com.atlassian.jira.issue.search.OfBizSearchRequestStore.getSearchQueryFromGv(OfBizSearchRequestStore.java:468)
at com.atlassian.jira.issue.search.OfBizSearchRequestStore.convertGVToRequest(OfBizSearchRequestStore.java:442)
at com.atlassian.jira.issue.search.OfBizSearchRequestStore.getSearchRequest(OfBizSearchRequestStore.java:216)
at com.atlassian.jira.issue.search.CachingSearchRequestStore.getSearchRequest(CachingSearchRequestStore.java:195)
at com.atlassian.jira.issue.search.DefaultSearchRequestManager.getSearchRequestById(DefaultSearchRequestManager.java:134)
...
Caused by: com.atlassian.jira.jql.parser.JqlParseException: com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: MismatchedSetException(46!=null)
at com.atlassian.jira.jql.parser.DefaultJqlQueryParser.parseClause(DefaultJqlQueryParser.java:132)
...
Caused by: com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: MismatchedSetException(46!=null)
at com.atlassian.jira.jql.parser.antlr.JqlLexer.recover(JqlLexer.java:129)
at com.atlassian.jira.jql.parser.antlr.JqlLexer.recover(JqlLexer.java:135)
...
Caused by: MismatchedSetException(46!=null)
at com.atlassian.jira.jql.parser.antlr.JqlLexer.recover(JqlLexer.java:134)
... 174 more
Symptom #2
Upgrading JIRA Agile fails, and the following errors appear in the atlassian-jira.log
:
2014-06-05 13:23:18,569 http-bio-8080-exec-19 ERROR xxxx.xxxx 803x5199x1 v03lu7 xx.xx.xx.xx,xx.xx.xx.xx /rest/plugins/1.0/com.pyxis.greenhopper.jira-key [sal.core.upgrade.DefaultPluginUpgradeManager] Error(s) encountered while upgrading plugin 'JIRA Agile' on enable.
2014-06-05 13:23:18,569 http-bio-8080-exec-19 ERROR xxxx.xxxx 803x5199x1 v03lu7 xx.xx.xx.xx,xx.xx.xx.xx /rest/plugins/1.0/com.pyxis.greenhopper.jira-key [sal.core.upgrade.DefaultPluginUpgradeManager] Upgrade error: Unexpected exception caught during plugin upgrade: com.atlassian.jira.exception.DataAccessException: com.atlassian.jira.jql.parser.JqlParseException: com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: MismatchedSetException(46!=null)
at com.atlassian.jira.issue.search.OfBizSearchRequestStore.getSearchQueryFromGv(OfBizSearchRequestStore.java:471)
at com.atlassian.jira.issue.search.OfBizSearchRequestStore.convertGVToRequest(OfBizSearchRequestStore.java:445)
at com.atlassian.jira.issue.search.OfBizSearchRequestStore.getSearchRequest(OfBizSearchRequestStore.java:219)
at com.atlassian.jira.issue.search.CachingSearchRequestStore.getSearchRequest(CachingSearchRequestStore.java:193)
...
Caused by: com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException: MismatchedSetException(46!=null)
at com.atlassian.jira.jql.parser.antlr.LexerErrorHelper.handleError(LexerErrorHelper.java:55)
at com.atlassian.jira.jql.parser.antlr.JqlLexer.recover(JqlLexer.java:129)
at com.atlassian.jira.jql.parser.antlr.JqlLexer.recover(JqlLexer.java:135)
原因
Related: - JRA-21708Getting issue details... STATUS
The reason for this error is because one (or more) of the filters that contain a period (.) is not enclosed by a quotation mark. For example, the following JQL contains an assignee (firstname.lastname) without a quotation.
assignee = firstname.lastname AND status in (Open, "In Progress", Reopened, Resolved)
回避策
To fix this problem, the filter that contains a period must be modified directly through the database.
- Create an extra XML backup, as it always safe to have an additional backup when modifying the database directly.
- Shutdown your JIRA instance.
Run the following SQL query to get the result of filters that contain a period.
select id,filtername, reqcontent from searchrequest where reqcontent like '%.%';
- Look for a filter that contains a period without the quotation. Generally, the value is related to the username (IE. firstname.lastname).
Identify the ID of that filter and modify the filter by adding quotations around the username.
For exampleupdate searchrequest set reqcontent = 'assignee = "firstname.lastname"' where id = <INSERT_ID_HERE>;
Notes: For MySQL, the quotations need to be escaped like so:
For exampleupdate searchrequest set reqcontent = 'assignee = \"firstname.lastname\"' where id = <INSERT_ID_HERE>;
- Start the JIRA instance.
- Re-index the JIRA instance.