[CONTROLLER-855] Error http 500 during PUT into ODL controller-config. Created: 18/Sep/14  Updated: 25/Jul/23  Resolved: 09/Nov/15

Status: Resolved
Project: controller
Component/s: config
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Peter NEMEC Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: All


Attachments: Text File content_of_config_initial.txt    
Issue Links:
Blocks
is blocked by NETCONF-4 Unify NetconfDocumentedException with... Confirmed
External issue ID: 1946

 Description   

curl -v -f -X PUT -H "Content-Type:application/xml" -H "Accept:application/xml" -d '<modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config"><module><name>test14</name></module></modules>' http://10.195.91.136:8080/restconf/config/opendaylight-inventory:nodes/node/controller-config/yang-ext:mount/config:modules

PRODUCES ERROR:
===============

  • Hostname was NOT found in DNS cache
  • Trying 10.195.91.136...
  • Connected to 10.195.91.136 (10.195.91.136) port 8080 (#0)
    > PUT /restconf/config/opendaylight-inventory:nodes/node/controller-config/yang-ext:mount/config:modules HTTP/1.1
    > User-Agent: curl/7.35.0
    > Host: 10.195.91.136:8080
    > Content-Type:application/xml
    > Accept:application/xml
    > Content-Length: 117
    >
  • upload completely sent off: 117 out of 117 bytes
  • The requested URL returned error: 500 Internal Server Error
  • Closing connection 0
    curl: (22) The requested URL returned error: 500 Internal Server Error

------------------------------------------------------------------------------
The same error , but in test code is:
------------------------------------------------------------------------------
Test_Scenario_PUT14_put_config_modules = {
'method': 'PUT',
'uri': '/config/opendaylight-inventory:nodes/node/controller-config/yang-ext:mount/config:modules',
'headers':

{'content-type': 'application/xml','accept': 'application/xml'}

,
'data': '''
<modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<module>
<name>test14</name>
</module>
</modules>
''',
'expected_status': 204,
'expected': '''
'''
}

------------------------------------------------------------------------------
Text output of test:
------------------------------------------------------------------------------
Test_Scenario_PUT14_put_config_modules | FAIL |
<html><head><title>Apache Tomcat/7.0.53 - Error report</title><style><!--H1

{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}

H2

{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;}

H3

{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;}

BODY

{font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}

B

{font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;}

P

{font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}

A

{color : black;}

A.name

{color : black;}

HR

{color : #525D76;}

--></style> </head><body><h1>HTTP Status 500 - RemoteDevice

{controller-config}: Error while replacing /(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)modules</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>RemoteDevice{controller-config}

: Error while replacing /(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)modules</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.RuntimeException: RemoteDevice

{controller-config}: Error while replacing /(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)modules
org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceWriteOnlyTx.put(NetconfDeviceWriteOnlyTx.java:125)
[ Message content over the limit has been removed. ]
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.53 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.53</h3></body></html>: 500 != 204


-------------------------------------------------------------------------------
Content of /opt/opendaylight/logs/opendaylight.log:
-------------------------------------------------------------------------------

at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [bundlefile:4.0.23.Final]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
2014-09-17 05:41:09.935 PDT [http-bio-8080-exec-4] WARN o.o.c.s.c.n.s.t.NetconfDeviceWriteOnlyTx - RemoteDevice{controller-config}

: Error putting data to /(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)modules, data: ImmutableContainerNode{nodeIdentifier=(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)modules, value=[ImmutableMapNode{nodeIdentifier=(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)module, value=[ImmutableMapEntryNode{nodeIdentifier=(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)module[

{(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)name=test14}

], value=[ImmutableLeafNode{nodeIdentifier=(urn:opendaylight:params:xml:ns:yang:controller:config?revision=2013-04-05)name, value=test14, attributes={}}], attributes={}}]}], attributes={}}, discarding changes
java.util.concurrent.ExecutionException: RemoteDevice

{controller-config}

: Pre-commit rpc failed, request: Node[ImmutableCompositeNode], qName[edit-config], modify[n/a], children.size = 3, errors: [RpcError [message=One element urn:opendaylight:params:xml:ns:yang:controller:config:type expected in XmlElement

{name='module', namespace='urn:opendaylight:params:xml:ns:yang:controller:config'}

but was 0, severity=ERROR, errorType=APPLICATION, tag=invalid-value, applicationTag=null, info=, cause=null]]
at org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceWriteOnlyTx.sendEditRpc(NetconfDeviceWriteOnlyTx.java:238) ~[bundlefile:na]
at org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceWriteOnlyTx.put(NetconfDeviceWriteOnlyTx.java:120) ~[bundlefile:na]
at org.opendaylight.controller.sal.connect.netconf.sal.tx.NetconfDeviceReadWriteTx.put(NetconfDeviceReadWriteTx.java:46) [bundlefile:na]
at org.opendaylight.controller.sal.restconf.impl.BrokerFacade.putDataViaTransaction(BrokerFacade.java:227) [bundlefile:na]
at org.opendaylight.controller.sal.restconf.impl.BrokerFacade.commitConfigurationDataPut(BrokerFacade.java:115) [bundlefile:na]



 Comments   
Comment by Peter NEMEC [ 18/Sep/14 ]

Attachment content_of_config_initial.txt has been added with description: configs , 99... is controller-config loopback

Comment by Maros Marsalek [ 24/Sep/14 ]

Data is invalid so rpc-error is expected. However the response code should not be 500, restconf should handle the response as error and respond with 4xx response code.

Comment by Jozef Gloncak [ 25/Sep/14 ]

Server should response with 4** HTTP errors.
In this case when PUT operation fails in NetconfDeviceWriteOnlyTx the exception RuntimeException is raised which is probably mapped to HTTP 500 error code.

In enhancement 1110 it is planned to create common exception for netconf and restconf. Once the same exception will be visible in netconf and restconf then it can be handled in restconf and better HTTP response will be returned.

NETCONF-4 was set as blocker.

Comment by Tony Tkacik [ 09/Nov/15 ]

Data were invalid, server error expected.

Generated at Wed Feb 07 19:54:03 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.