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

"Problem (2) in the Chunked-Encoded data" while performing a CURL request #89

Closed
eXsio opened this Issue Jul 4, 2014 · 21 comments

Comments

Projects
None yet
8 participants
@eXsio
Contributor

eXsio commented Jul 4, 2014

Hello

I've stumbled on a weird error lately. I've switched my computer to a newer model and started experiencing weird random behaviours when interacting with Jackrabbit. Sometimes (without a particular reason), when a CURL request is dispatched to my local Jackrabbit, this exception is thrown:

PHPCR\RepositoryException
Message: Not a valid json object: 
Request: POST http://localhost:7400/server/[repo_name]/jcr:root/.0.json 
Response: 

It turns out, that the response returned by CURL is a boolean(false). Tracking the latest curl_error associated with the problematic handle revealed a cryptic error msg:

Problem (2) in the Chunked-Encoded data

Don't know, if anyone else had a problem like that. It turned out, that the solution is simple. All it takes for CURL to start behaving normally is adding a new option to CURL handle:

$curl->setopt(CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);

in

Jackalope\Transport\Jackrabbit\Request::singleRequest(436)

This option changes the HTTP version from 1.1 to 1.0. From my experience that did not break antyhing, but I can't be sure. I dont know what is causing this error - is it my NIC driver or something else... on my teammates computer everything looks fine. Any ideas? Thoughts?

@lsmith77

This comment has been minimized.

Show comment
Hide comment
@lsmith77

lsmith77 Jul 4, 2014

Member

never encountered that problem. how did you install php?

Member

lsmith77 commented Jul 4, 2014

never encountered that problem. how did you install php?

@eXsio

This comment has been minimized.

Show comment
Hide comment
@eXsio

eXsio Jul 5, 2014

Contributor

System: Ubuntu 14.04
Server: Zend-Server 6.3 (PHP 5.5)
Jackrabbit: 2.4.4 (also tested on 2.8)

But the weird thing is, that another computer has exactly the same setup (both were installed at the same time) and the described problem appears only on one of them.

Contributor

eXsio commented Jul 5, 2014

System: Ubuntu 14.04
Server: Zend-Server 6.3 (PHP 5.5)
Jackrabbit: 2.4.4 (also tested on 2.8)

But the weird thing is, that another computer has exactly the same setup (both were installed at the same time) and the described problem appears only on one of them.

@dbu

This comment has been minimized.

Show comment
Hide comment
@dbu

dbu Jul 7, 2014

Member

just as you say something about "chunked", does the option sendExpect have any influence? https://github.com/jackalope/jackalope-jackrabbit/blob/master/src/Jackalope/Transport/Jackrabbit/Client.php#L175-L179

if you use symfony, the config option would be this: http://symfony.com/doc/master/cmf/reference/configuration/phpcr_odm.html#jackalope-jackrabbit-expect

Member

dbu commented Jul 7, 2014

just as you say something about "chunked", does the option sendExpect have any influence? https://github.com/jackalope/jackalope-jackrabbit/blob/master/src/Jackalope/Transport/Jackrabbit/Client.php#L175-L179

if you use symfony, the config option would be this: http://symfony.com/doc/master/cmf/reference/configuration/phpcr_odm.html#jackalope-jackrabbit-expect

@dbu

This comment has been minimized.

Show comment
Hide comment
@dbu

dbu Jul 14, 2014

Member

@eXsio did you find anything?

Member

dbu commented Jul 14, 2014

@eXsio did you find anything?

@eXsio

This comment has been minimized.

Show comment
Hide comment
@eXsio

eXsio Sep 10, 2014

Contributor

Hi

It turned out, that the other computer, that I thought was bug-free also suffers from the same issue. This problem now affects 3 different servers. They all have 2 things in common:

  • OS: Ubuntu 14.04
  • PHP minor version: 5.5 (5.5.7, 5.5.9)

Two of them have Zend Server 6.3 with bundled PHP and one of them has system PHP with php5-fpm. The only valid solution I've came across is the one I have in the first post. The problem appears when loading random node from repo.

Contributor

eXsio commented Sep 10, 2014

Hi

It turned out, that the other computer, that I thought was bug-free also suffers from the same issue. This problem now affects 3 different servers. They all have 2 things in common:

  • OS: Ubuntu 14.04
  • PHP minor version: 5.5 (5.5.7, 5.5.9)

Two of them have Zend Server 6.3 with bundled PHP and one of them has system PHP with php5-fpm. The only valid solution I've came across is the one I have in the first post. The problem appears when loading random node from repo.

@eXsio

This comment has been minimized.

Show comment
Hide comment
@eXsio

eXsio Sep 10, 2014

Contributor

I think I know what the problem is. It will require some testing, but it seems that the culprit was old version of cURL library in system. After upgrading from 7.35 to 7.36 the problem disappeared. In order to upgrade cURL in Ubuntu 14.04 one have to:

sudo add-apt-repository ppa:costamagnagianfranco/ettercap-stable-backports

sudo apt-get update

sudo apt-get install curl

After performing tests and reassuring that this definitely solved the problem, I will confirm it here.

Contributor

eXsio commented Sep 10, 2014

I think I know what the problem is. It will require some testing, but it seems that the culprit was old version of cURL library in system. After upgrading from 7.35 to 7.36 the problem disappeared. In order to upgrade cURL in Ubuntu 14.04 one have to:

sudo add-apt-repository ppa:costamagnagianfranco/ettercap-stable-backports

sudo apt-get update

sudo apt-get install curl

After performing tests and reassuring that this definitely solved the problem, I will confirm it here.

@dbu

This comment has been minimized.

Show comment
Hide comment
@dbu

dbu Sep 10, 2014

Member

i am on ubuntu 14.04 too, with php 5.5.9 and curl 7.35.0 - and at least the test suite and what we do with the phpcr-odm all runs fine. maybe its a 32 bit vs 64 bit issue or something like that. i seem to be on 32bit. which are you?

Member

dbu commented Sep 10, 2014

i am on ubuntu 14.04 too, with php 5.5.9 and curl 7.35.0 - and at least the test suite and what we do with the phpcr-odm all runs fine. maybe its a 32 bit vs 64 bit issue or something like that. i seem to be on 32bit. which are you?

@eXsio

This comment has been minimized.

Show comment
Hide comment
@eXsio

eXsio Sep 11, 2014

Contributor

All machines are on 64bit version. Plus I have a fairly large and complicated data structure persisted in Jackrabbit, don't know if that may be a factor... As I've said, I will continue to monitor the situation.

Contributor

eXsio commented Sep 11, 2014

All machines are on 64bit version. Plus I have a fairly large and complicated data structure persisted in Jackrabbit, don't know if that may be a factor... As I've said, I will continue to monitor the situation.

@dbu

This comment has been minimized.

Show comment
Hide comment
@dbu

dbu Sep 11, 2014

Member

sure. glad if you can report back and we might prevent the problem in
the future, or have an answer should anybody hit it as well.

Member

dbu commented Sep 11, 2014

sure. glad if you can report back and we might prevent the problem in
the future, or have an answer should anybody hit it as well.

@eXsio

This comment has been minimized.

Show comment
Hide comment
@eXsio

eXsio Sep 16, 2014

Contributor

This is now tested on 3 different servers. After installing cURL 7.36 on 64 bit Ubuntu 14.04 with PHP 5.5.x the problem disappeared.

Contributor

eXsio commented Sep 16, 2014

This is now tested on 3 different servers. After installing cURL 7.36 on 64 bit Ubuntu 14.04 with PHP 5.5.x the problem disappeared.

@ulkas

This comment has been minimized.

Show comment
Hide comment
@ulkas

ulkas Oct 9, 2014

thank you, we have similar problem with our Laravel framework. we also had php curl version 7.35 which caused the troubles. lower and higher version are OK.

ulkas commented Oct 9, 2014

thank you, we have similar problem with our Laravel framework. we also had php curl version 7.35 which caused the troubles. lower and higher version are OK.

@dbu

This comment has been minimized.

Show comment
Hide comment
@dbu

dbu Oct 9, 2014

Member

@eXsio should we put an incompatibility with 7.35 into composer.json? can composer even check that?

@ulkas are you using phpcr in your laravel project? or just curl and stumbled over this issue while investigating?

Member

dbu commented Oct 9, 2014

@eXsio should we put an incompatibility with 7.35 into composer.json? can composer even check that?

@ulkas are you using phpcr in your laravel project? or just curl and stumbled over this issue while investigating?

@eXsio

This comment has been minimized.

Show comment
Hide comment
@eXsio

eXsio Oct 9, 2014

Contributor

Propably a good idea. This error is very hard to track down. I think that such restriction would be very helpful. And if it's not doable using Composer, maybe a notice about possible problems with 7.35 in installation instructions?

Contributor

eXsio commented Oct 9, 2014

Propably a good idea. This error is very hard to track down. I think that such restriction would be very helpful. And if it's not doable using Composer, maybe a notice about possible problems with 7.35 in installation instructions?

@ulkas

This comment has been minimized.

Show comment
Hide comment
@ulkas

ulkas Oct 9, 2014

@dbu i'm using the default laravel homestead setup which uses phps libcurl. but the fix from @eXsio helped.

ulkas commented Oct 9, 2014

@dbu i'm using the default laravel homestead setup which uses phps libcurl. but the fix from @eXsio helped.

@dbu

This comment has been minimized.

Show comment
Hide comment
@dbu

dbu Oct 9, 2014

Member

+1

do you want to try this @eXsio ?

Member

dbu commented Oct 9, 2014

+1

do you want to try this @eXsio ?

eXsio added a commit to eXsio/jackalope-jackrabbit that referenced this issue Oct 9, 2014

Update composer.json
restrict the use of lib-curl 7.35 in order to avoid "Problem (2) in the Chunked-Encoded data" described here: jackalope#89

@dbu dbu closed this in #95 Oct 10, 2014

dbu added a commit that referenced this issue Oct 24, 2014

dbu added a commit that referenced this issue Nov 13, 2014

Merge pull request #97 from jackalope/revert-curl-conflict
revert #89 as that version of curl does work on some systems
@danrot

This comment has been minimized.

Show comment
Hide comment
@danrot

danrot Mar 26, 2015

Contributor

Just FYI: We are running into this same issue again on curl 7.36, curl_error also shows the same error:

Problem (2) in the Chunked-Encoded data

For us it happens if we add a reference to one of two specific nodes. Then both sides of the references is failing with this issue. We' don't really know why it's failing exactly for these two pages.

Setting the HTTP version to 1.0 as described above works for us.

We are now trying to update to a newer curl version, and see if this works.

Contributor

danrot commented Mar 26, 2015

Just FYI: We are running into this same issue again on curl 7.36, curl_error also shows the same error:

Problem (2) in the Chunked-Encoded data

For us it happens if we add a reference to one of two specific nodes. Then both sides of the references is failing with this issue. We' don't really know why it's failing exactly for these two pages.

Setting the HTTP version to 1.0 as described above works for us.

We are now trying to update to a newer curl version, and see if this works.

@danrot

This comment has been minimized.

Show comment
Hide comment
@danrot

danrot Mar 26, 2015

Contributor

@eXsio Do you remember if this also happened if you executed a curl request from the terminal? This works for us, but in PHP we get this error... And the changelog of curl doesn't include any changes concerning chunk encoding since 7.36...

Contributor

danrot commented Mar 26, 2015

@eXsio Do you remember if this also happened if you executed a curl request from the terminal? This works for us, but in PHP we get this error... And the changelog of curl doesn't include any changes concerning chunk encoding since 7.36...

@zw8686

This comment has been minimized.

Show comment
Hide comment
@zw8686

zw8686 Apr 22, 2016

Hello, I am using json_decode function, met
"Problem (2) in the Chunked - Encoded data"
And you know how to solve?

zw8686 commented Apr 22, 2016

Hello, I am using json_decode function, met
"Problem (2) in the Chunked - Encoded data"
And you know how to solve?

@dbu

This comment has been minimized.

Show comment
Hide comment
@dbu

dbu Apr 22, 2016

Member

it seems curl 7.35 was reason for this issue in the past.
for others, the force_http_version_10 option to the jackalope-jackrabbit transport helped. did you try those two things already?

Member

dbu commented Apr 22, 2016

it seems curl 7.35 was reason for this issue in the past.
for others, the force_http_version_10 option to the jackalope-jackrabbit transport helped. did you try those two things already?

@LocutusOfBorg

This comment has been minimized.

Show comment
Hide comment
@LocutusOfBorg

LocutusOfBorg Aug 29, 2016

lol, happy to see people are using my ettercap backport to get an updated curl
I'll fix the trusty version in an update soon :)

LocutusOfBorg commented Aug 29, 2016

lol, happy to see people are using my ettercap backport to get an updated curl
I'll fix the trusty version in an update soon :)

@jpeak5

This comment has been minimized.

Show comment
Hide comment
@jpeak5

jpeak5 Jan 5, 2018

thanks much jackalope people! for the suggestion to upgrade cURL on Ubuntu...

jpeak5 commented Jan 5, 2018

thanks much jackalope people! for the suggestion to upgrade cURL on Ubuntu...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment