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

DynamoDB Session Handler exceptions #42

Closed
ralph-tice opened this issue Feb 8, 2013 · 6 comments
Closed

DynamoDB Session Handler exceptions #42

ralph-tice opened this issue Feb 8, 2013 · 6 comments
Labels
bug This issue is a bug.

Comments

@ralph-tice
Copy link

  1. Occasionally I get some exceptions:
    PHP Fatal error: Undefined class constant 'Aws\\Common\\Client\\UserAgentListener::OPTION' in /var/www/dynamodb_session_handler/vendor/aws/aws-sdk-php/src/Aws/DynamoDb/Session/LockingStrategy/AbstractLockingStrategy.php on line 82
    PHP Fatal error: Cannot declare self-referencing constant 'Aws\\Common\\Client\\UserAgentListener::OPTION' in /var/www/dynamodb_session_handler/vendor/aws/aws-sdk-php/src/Aws/DynamoDb/Session/LockingStrategy/AbstractLockingStrategy.php on line 82
  2. Also, more rarely, been getting this: PHP Fatal error: Uncaught exception 'Guzzle\Http\Exception\CurlException' with message '[curl] 65: necessary data rewind wasn't possible [url] https://dynamodb.us-east-1.amazonaws.com/' in /var/www/dynamodb_session_handler/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php:595\nStack trace: #0 /var/www/dynamodb_session_handler/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(526): Guzzle\Http\Curl\CurlMulti->isCurlException(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array) #1 /var/www/dynamodb_session_handler/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(458): Guzzle\Http\Curl\CurlMulti->processResponse(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array) #2 /var/www/dynamodb_session_handler/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(418): Guzzle\Http\Curl\CurlMulti->processMessages() #3 /var/www/dynamodb_session_handler/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(278): Guzzle\Http\Curl\CurlMu in /var/www/dynamodb_session_handler/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php on line 595

What would cause this? I'm on PHP 5.3.19...

@jeremeamia
Copy link
Contributor

For [1], I just committed something that should fix that: 807cec5. Seems related to #13.

For [2], hmmm... off hand, I have no idea, so I'll have to investigate. If you are able to debug a little and find out which part of the session handler (writes, reads, etc.) it is happening in that would help. Also, some questions:

  1. How often does this happen?
  2. How big are your sessions?
  3. What is your table throughput?
  4. Do you know for sure it is happening in the session handler?

@ralph-tice
Copy link
Author

Thanks for the quick response! On a Friday!
[2] happened 4 times in 4 hours.
My sessions are averaging around 4-5kb in size.
I have my session table provisioned at 80/80 read/write, and on the 5 minute graph I'm peaking at around 3k. Nobody's been able to explain how the provisioned numbers relate to the 5 minute capacity graphs, though.
I'm only using this deployment of the SDK for session handling, so I don't think there's any chance of it occurring from any other cause, if you mean am I using DynamoDB for anything besides session handling in this case, I am not.
I have gc_probability set to zero, so it's not garbage collection related for sure, but I'm not sure if it was a read or a write. I'm not sure how to trap errors further, should I register a shutdown handler to record a better stack trace than I'm currently getting?

@jeremeamia
Copy link
Contributor

Yeah, I'd try using a shutdown function or custom exception handler and see if you can get a better stack trace or debug_backtrace and see what part of the session handler is being used before the cURL exception occurs. Thanks. I'll look more into it this week.

@ralph-tice
Copy link
Author

[client 10.122.59.14] PHP Fatal error: Uncaught exception 'Guzzle\\Http\\Exception\\CurlException' with message '[curl] 65: necessary data rewind wasn't possible [url] https://dynamodb.us-east-1.amazonaws.com/ [info] array ( 'url' => 'https://dynamodb.us-east-1.amazonaws.com/', 'content_type' => NULL, 'http_code' => 0, 'header_size' => 0, 'request_size' => 534, 'filetime' => -1, 'ssl_verify_result' => 0, 'redirect_count' => 0, 'total_time' => 0.002426, 'namelookup_time' => 4.5E-5, 'connect_time' => 4.9E-5, 'pretransfer_time' => 0.00111, 'size_upload' => 9620, 'size_download' => 0, 'speed_download' => 0, 'speed_upload' => 3965375, 'download_content_length' => -1, 'upload_content_length' => -1, 'starttransfer_time' => 0.001117, 'redirect_time' => 0, 'certinfo' => array ( ), 'redirect_url' => '', ) [debug] ' in /var/www/dynamodb_session_handler/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php:561 Stack trace: #0 /var/www/dynamodb_session_handler/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.p in /var/www/dynamodb_session_handler/vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php on line 561

Didn't do anything different to get this output, so not sure if it's related or not but it looks to be a write to me...?

@mtdowling
Copy link
Member

Thanks for the information, ralph-tice. The problem is that, for some reason, the request is being resent internally inside of cURL. This could be caused by some sort of intermittent networking issue. When cURL needs to resend data that is previously sent, it attempts to rewind the data stream. Unfortunately, PHP does not allow a custom seek or ioctl function to be passed to cURL, so when cURL attempts to rewind our custom stream, it fails. Here's the related issue on PHP.net-- I would be grateful if you upvoted this issue: https://bugs.php.net/bug.php?id=47204

I've disabled the use of streaming requests when interacting with JSON services like Amazon DynamoDB. This will prevent cURL error 65 from occurring because cURL is able to rewind a string of POST data internally. This fix will be present in the next release.

@maknz
Copy link

maknz commented Aug 30, 2013

Hi,

I'm having this exact problem when doing file uploads to Amazon S3 using the SDK.

Aws \ Common \ Exception \ TransferException
[curl] 65: necessary data rewind wasn't possible [url] https://bucketr.s3.amazonaws.com/file.png

Is this related? I've only started seeing these errors today, and they are intermittent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

4 participants