Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005055TestLinkAPI - XMLRPCpublic2012-06-08 23:262014-04-25 17:38
Reportereliasn 
Assigned Tokinow 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformX64OSMac OS XOS Version10.7.4
Product Version1.9.3 (2011 Q3 - bug fixing) 
Fixed in Version1.9.10 (2014 Q1 - bug fixing) 
Summary0005055: Error attaching file via XMLRPC API
DescriptionWhen I try to send a file higher than 60kb I received the following message: "parse error. not well formed"
Additional InformationI'm trying to send this attachment with a Java code. I know that Java is not the problem, but it always happens for a file higher tha 60kb.

With this error it's not usefull use this functionality (I'm using this to upload an image in every failed test case in test execution) because any screenshot that I capture have more than 60kb.

There's a issue on apache XMLRCP project explain that https://issues.apache.org/jira/browse/XMLRPC-171 [^]
Probably it will not solved... =/

The full exception:
Caused by: org.apache.xmlrpc.XmlRpcException: parse error. not well formed
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:197)
    at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
    at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
    at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
    at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
    at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:147)

TagsNo tags attached.
Database (MySQL,Postgres,etc)MySQL
BrowserFrefox 13
PHP Version
TestCaseID
QA Team - Task Workflow StatusREADY FOR TESTING
Attached Files

- Relationships
child of 0006048closedfman Availables hot-fixes for 1.9.9 & How To get full fixed package from gitorious 

-  Notes
(0016849)
fman (administrator)
2012-06-09 16:04

Can you test with our php client ?
(0016850)
fman (administrator)
2012-06-09 16:05

Reminder sent to: kinow

can you give a look, first with our PHP example, then with a java client ? ( please add java client to stable code both on 1.9.4 and 2.0)
(0016852)
kinow (reporter)
2012-06-11 03:23

Sure thing Francisco. I've worked on a very similar issue in the java-api, so hopefully it won't be hard to reproduce this issue.

I will use our PHP example, and then the Java client. I will add the Java client to both versions as you suggested too :-) I'm just finishing the code for the CSRF issue, and then will resync my local repositories.

Thanks
(0020223)
moormanm (reporter)
2013-12-18 18:08
edited on: 2013-12-18 18:16

I too ran into this issue with large files.

I did some debugging on the testlink API side and pinned the problem down to the xmlrpc library in third_party/xml-rpc/class-IXR.php.

In the parse() function of the IXR_Message class, there is a block of code:

$this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message);
if (trim($this->message) == '') {
  return false;
}

For large attachments, preg_replace is hitting the php backtrack limit setting, which is 100k by default. When the backtrack limit is exceeded, preg_replace returns an empty string.

You can set the backtrack limit in php.ini with:
pcre.backtrack_limit


You might also want/need to up the recursion limit, max post size, and max file upload limits:

pcre.recursion_limit
post_max_size
upload_max_filesize

In the /class-IXR.php, it would be nice if it checked for the backtrack limit error and then bubble up a better error message to the user:

if (trim($this->message) == '') {
   if (preg_last_error() == PREG_BACKTRACK_LIMIT_ERROR) {
      //Backtrack limit was hit, bubble up error
   }
   return false;
}


EDIT:

I think you can avoid the memory issue all together by using the optional "limit" parameter in the preg_replace function.

$this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message, 1);

http://www.php.net/preg_replace [^]

(0020224)
fman (administrator)
2013-12-18 18:18

OK, thanks
we are going to understand if we can add this as a permanet fix
(0020225)
kinow (reporter)
2013-12-18 18:34

@moormanm, would you like to submit a patch for this? :)
(0020234)
moormanm (reporter)
2013-12-20 23:17

I made a merge request: https://gitorious.org/testlink-ga/testlink-code/merge_requests/9 [^]

I'm new at this, hopefully the request is targeted properly :-)
(0020240)
fman (administrator)
2013-12-25 12:19

applied change on branch 1.9

https://gitorious.org/testlink-ga/testlink-code/commit/0c264bf2f3357cce3ffc6cecbd720ad4c287bec6 [^]
(0020802)
fman (administrator)
2014-04-25 17:38

1.9.10 released

- Issue History
Date Modified Username Field Change
2012-06-08 23:26 eliasn New Issue
2012-06-09 16:04 fman Note Added: 0016849
2012-06-09 16:05 fman Note Added: 0016850
2012-06-11 03:23 kinow Note Added: 0016852
2012-07-02 16:39 kinow Assigned To => kinow
2012-07-02 16:39 kinow Status new => assigned
2013-04-25 17:30 fman Category TL API => XMLRPC API
2013-04-25 17:30 fman Category XMLRPC API => API - XMLRPC
2013-12-18 18:08 moormanm Note Added: 0020223
2013-12-18 18:16 moormanm Note Edited: 0020223 View Revisions
2013-12-18 18:18 fman Note Added: 0020224
2013-12-18 18:18 fman QA Team - Task Workflow Status => TBD
2013-12-18 18:18 fman Summary Error in attachment => Error attaching file via XMLRPC API
2013-12-18 18:34 kinow Note Added: 0020225
2013-12-20 23:17 moormanm Note Added: 0020234
2013-12-25 12:19 fman Note Added: 0020240
2013-12-25 12:20 fman QA Team - Task Workflow Status TBD => READY FOR TESTING
2013-12-25 12:20 fman Fixed in Version => 1.9.10 (2014 Q1 - bug fixing)
2013-12-25 12:20 fman Relationship added child of 0006048
2014-04-25 14:49 fman Status assigned => resolved
2014-04-25 14:49 fman Resolution open => fixed
2014-04-25 17:38 fman Note Added: 0020802
2014-04-25 17:38 fman Status resolved => closed



Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker