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

Server crash after updating 'External rules definition' with 0.9.1 #253

Closed
guwirth opened this issue Jul 6, 2014 · 6 comments · Fixed by #254
Closed

Server crash after updating 'External rules definition' with 0.9.1 #253

guwirth opened this issue Jul 6, 2014 · 6 comments · Fixed by #254
Assignees
Labels
Milestone

Comments

@guwirth
Copy link
Collaborator

guwirth commented Jul 6, 2014

After changing/updating a 'rule definition' in 'External rules definition' in the backend and restarting the server I get the messages below. Server is no more running, I also can't access the backend anymore.

@jmecosta: Is there a possibility to delete/remove the rule definition to start the server again?

wrapper  | --> Wrapper Started as Console
wrapper  | Launching a JVM...
jvm 1    | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1    |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.
jvm 1    | 
jvm 1    | 2014-07-06 13:57:35.816:INFO:oejs.Server:jetty-7.6.11.v20130520
jvm 1    | 2014-07-06 13:57:45.715:WARN:oejw.WebAppContext:Failed startup of context o.e.j.w.WebAppContext{/,file:/D:/Sonar/sonar-3.7.3/war/sonar-server/},file:/D:/Sonar/sonar-3.7.3/war/sonar-server
jvm 1    | org.hibernate.exception.DataException: could not update: [org.sonar.api.rules.Rule#7275]
jvm 1    |  at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:100)
jvm 1    |  at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
jvm 1    |  at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2443)
@jmecosta
Copy link
Member

jmecosta commented Jul 6, 2014

Easiest way perhaps is to comment out the code that imports the rules and
restart the server without it. After go to definition and delete. Can you
provide the XML that cause this? Was pretty sure that if the XML is
malformed it should allow to start the server.
On Jul 6, 2014 3:06 PM, "Günter Wirth" notifications@github.com wrote:

After changing/updating a 'rule definition' in 'External rules definition'
in the backend and restarting the server I get the messages below. Server
is no more running, I also can't access the backend anymore.

@jmecosta https://github.com/jmecosta: Is there a possibility to
delete/remove the rule definition to start the server again?

wrapper | --> Wrapper Started as Console
wrapper | Launching a JVM...
jvm 1 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
jvm 1 |
jvm 1 | 2014-07-06 13:57:35.816:INFO:oejs.Server:jetty-7.6.11.v20130520
jvm 1 | 2014-07-06 13:57:45.715:WARN:oejw.WebAppContext:Failed startup of context o.e.j.w.WebAppContext{/,file:/D:/Sonar/sonar-3.7.3/war/sonar-server/},file:/D:/Sonar/sonar-3.7.3/war/sonar-server
jvm 1 | org.hibernate.exception.DataException: could not update: [org.sonar.api.rules.Rule#7275]
jvm 1 | at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:100)
jvm 1 | at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
jvm 1 | at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2443)


Reply to this email directly or view it on GitHub
#253.

@guwirth
Copy link
Collaborator Author

guwirth commented Jul 6, 2014

Was pretty sure that if the XML is malformed it should allow to start the server.

Yes you are right, was a typo in the XML.

This is a very critical issue: A simple typo crashes the whole server without any chance to reset it. There must be something like:

  • verify XML before save it in DB
  • or automatic deletion if server can't start
  • or config setting to ignore settings during start

comment out the code that imports the rules

Could you give a hint. What do I have to comment out?

... Provide the XML ...

When I'm able to restart the server I try to forward it.

@jmecosta
Copy link
Member

jmecosta commented Jul 6, 2014

you can take out the

for(String ruleDefs : settings.getStringArray(RULES_KEY)){
if (StringUtils.isNotBlank(ruleDefs)) {
rules.addAll(xmlRuleParser.parse(new StringReader(ruleDefs)));
}
}

in
https://github.com/wenns/sonar-cxx/blob/master/sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/externalrules/CxxExternalRuleRepository.java

Now looking at the code, i was pretty sure ive included a try catch there
so that the server is able to start even if it throws exception. I will
check again my pull request

As far as i know there is no way to validate the xml in the web ui. For
this reason, sonar folks are prefering the "template rule" method that you
can copy into a new rule and define everything without the need to
restarting the server. The drawback of this is you need to define the rules
one by one which in our case is not possible.

On Sun, Jul 6, 2014 at 4:46 PM, Günter Wirth notifications@github.com
wrote:

Was pretty sure that if the XML is malformed it should allow to start the
server.

Yes you are right, was a typo in the XML.

This is a very critical issue: A simple typo crashes the whole server
without any chance to reset it. There must be something like:

  • verify XML before save it in DB
  • or automatic deletion if server can't start
  • or config setting to ignore settings during start

comment out the code that imports the rules

Could you give a hint. What do I have to comment out?


Reply to this email directly or view it on GitHub
#253 (comment).

@jmecosta
Copy link
Member

jmecosta commented Jul 6, 2014

OK got it, the error handling was added to to fxcop repository. I will
create pull request to fix this asap.
On Jul 6, 2014 4:46 PM, "Günter Wirth" notifications@github.com wrote:

Was pretty sure that if the XML is malformed it should allow to start the
server.

Yes you are right, was a typo in the XML.

This is a very critical issue: A simple typo crashes the whole server
without any chance to reset it. There must be something like:

  • verify XML before save it in DB
  • or automatic deletion if server can't start
  • or config setting to ignore settings during start

comment out the code that imports the rules

Could you give a hint. What do I have to comment out?


Reply to this email directly or view it on GitHub
#253 (comment).

@guwirth guwirth added the bug label Jul 6, 2014
@guwirth
Copy link
Collaborator Author

guwirth commented Jul 6, 2014

Thx

@guwirth
Copy link
Collaborator Author

guwirth commented Aug 29, 2014

Added some hints to rule file description with limits for XML tags.
https://github.com/wenns/sonar-cxx/wiki/Extending-the-code-analysis

@wenns wenns added this to the M 0.9.2 milestone Dec 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants