SSL Buffer exceptions

Skip to first unread message


Nov 14, 2011, 2:16:28 AM11/14/11
to ActiveSalesforce
In the absence of a Reports REST API from Salesforce, I'm attempting
to do a series of SOQL queries that will return the data I need, and
from the returned data assembling the Report I want in Ruby.

It seems to work fine, and against my Sandbox instance I have no
issues at all.

When connecting to a Production instance, I'm running into odd SSL
buffering exceptions, that lead me to believe there might be a
possible bug in the databasedotcom gem or the http adapter.

If I do a standard client.query, then the page size of the returned
collection seems to be 2000 records. If I then do SOQL query using
attributes from all the results in a given collection page to get
related records, then I get the following error:

145:in `sysread_nonblock': Connection reset by peer
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/openssl/
buffering.rb:145:in `read_nonblock'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/protocol.rb:
135:in `rbuf_fill'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/protocol.rb:
116:in `readuntil'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/protocol.rb:
126:in `readline'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:2211:in
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:2200:in
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1183:in
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1169:in
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1162:in
`block in request'
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:627:in
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:1160:in
from ~/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:880:in
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:289:in `block in http_get'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:336:in `block (2 levels) in
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:343:in `with_logging'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:335:in `block in
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:349:in `ensure_expected_response'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:288:in `http_get'
from ~/.rvm/gems/ruby-1.9.2-p136/gems/databasedotcom-1.2.3/lib/
databasedotcom/client.rb:204:in `query'

The query is nothing complex, and of the form:

client.query('SELECT Id, Custom_Attribute__c FROM Custom_Object__c
WHERE Id IN ('A','B'...)")

If I modify my code to only do subsequent SOQL queries in batches of
250 records or less, then the code executes fine. Clearly, I could
just operate on batches of 250 records, but this will increase the
number of API calls, and for the Production system I'm aiming to
deploy to this could become an issue.

I suspect the issue might be to do with a chunked response from
Salesforce. Is this the case? What's the solution?

Thanks in advance. M

Danny Burkes

Nov 14, 2011, 2:51:01 AM11/14/11
Could be, but it looks to me like the far end (Salesforce) is closing the connection unexpectedly.  Can you execute the same request (including auth headers) with curl and get a reasonable response from Salesforce?

- D

You received this message because you are subscribed to the Google Groups "ActiveSalesforce" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Merul Patel

Nov 14, 2011, 4:07:47 AM11/14/11
Thanks for the quick reply. Looks like your right. I didn't check with cURL but tested with the Soql Xplorer and the SOQL query being generated has more than 10,000 characters so is causing the issue.

Regards, M

Merul Patel
Sent with Sparrow

Reply all
Reply to author
0 new messages