I have a rspec suite that runs perfectly on OS X, but fails on ubuntu for all specs that call a specific method.
The error I am seeing is:
SystemStackError - stack level too deep:
/home/ubuntu/.rvm/gems/ruby-1.9.3-p194#testset/gems/multi_json-1.5.0/lib/multi_json.rb:75
As shown I have a dependancy on active_support, which requires multi_json. This line is requiring the adapter for json_gem, all of this seems internal to the request parsing. The actual error occurs in the request parsing of the endpoint, somewhere inside of sinatra. None of my code is ever hit (my debug statement never gets hit).
As for the method, it is hitting a running test endpoint with a POST containing a small, preset JSON string as the body.
Help greatly appreciated!
Related
I'm using Rspec/Capybara with Poltergeist as a driver to write tests for some large web applications.
My issue is that I would like to record the messages that appear on the console, but so far I've been unable to do so.
I am aware of the options js_errors and phantomjs_logger, but I have had some issues with them:
if I set js_errors: false, the file I specify in phantomjs_logger stays empty;
if I set js_errors: true, console.log messages are logged in the file specified in phantomjs_logger, but then almost all my specs fail because of
javascript errors that may not even be relevant to the navigation example I'm testing.
Any idea on how I can save the console messages while not breaking specs on every js error?
CLARIFICATION:
I have no control over the development, my task is to check the stability of the whole stack of the applications in the various environments, accessing from the front-end, so clearing out all the javascript errors is out of the question. The specs I'm writing are also supposed to ignore javascript errors if they don't impair the usage of the interface.
You can't. The PhantomJS client catches javascript error messages and adds them to an array. Then when a command completes, if js_errors == true, that array is checked and if not empty the javascript errors are returned and trigger an error in the test. There is no other API in poltergeist for accessing those errors. It sounds like you need to have a discussion with your manager about the wisdom of just ignoring JS errors if they apparently don't impair usage - it's a potentially dangerous development practice
Even when all tests are passing, I see many many instances of this message amid the successful test output:
...
in the single-post view
behaves like editing a comment
HTTP request failed.
HTTP request failed.
HTTP request failed.
...
What is causing it?
One possibility is that requests made by for example third-party analytics scripts on your page are failing.
You can see their activity by inspecting the output of poltergeist's page.driver.network_traffic at the end of a test.
If you think this is the problem, you could take those scripts out of the picture by
including them in the page only if you're not running tests, or
using poltergeist's page.execute_script to replace appropriate functions in those third-party scripts with no-op functions. (That takes more work but leaves the page contents more production-like, which might catch a few more possible errors.)
I'm implementing an application that communicates with the GitHub API in order to infer some statistics about projects developed currently. I chose to make the requests asynchronously, using HttpAsyncClient.
My problem is that after I execute all requests and get all the responses from the API (around 150 of them) and I try to read the content with
String content = EntityUtils.toString(response.getEntity());
I'm getting following SSLException after ~120 responses read:
Exception in thread "main" javax.net.ssl.SSLException: SSL peer shut down incorrectly
at sun.security.ssl.InputRecord.readV3Record(InputRecord.java:557)
at sun.security.ssl.InputRecord.read(InputRecord.java:509)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:883)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:840)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:94)
at org.apache.http.impl.io.AbstractSessionInputBuffer.read(AbstractSessionInputBuffer.java:204)
at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:182)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:138)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:282)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:324)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:176)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.Reader.read(Reader.java:140)
at org.apache.http.util.EntityUtils.toString(EntityUtils.java:224)
at org.apache.http.util.EntityUtils.toString(EntityUtils.java:264)
at pl.xsolve.githubmetrics.github.OwnGitHubClient.extractBodyFromResponse(OwnGitHubClient.java:117)
The problem disappears when I decrease the number of requests significantly (for instance, by half). Also, all the responses contain HTTP/1.1 200 OK - I've checked it with response.getStatusLine() and it works until the very end of the response list.
The problem persists even if I remove httpClient.shutdown() in the finally block (which is executed before reading the content).
From the stack trace, I've concluded that the exception is thrown on the line
while((l = reader.read(tmp)) != -1)
Is the entity in the HttpResponse getting somehow outdated? Do you see an error in my reasoning? What can be the reason why first 120 responses are parsed properly and then SSLException is thrown?
Any help will be greatly appreciated :)
This could also be dependent upon your version of openssl. On a python project I maintain, we've seen errors in openssl 0.9.8 when people make large numbers of SSL requests in a short period of time. Admittedly it was nothing like your error message, but upgrading to openssl 1.0 might help.
I'm writing an application updater that pulls installation package from our distribution web site to the user's PC using the background intelligent download service facility.
More or less everything is working fine now but I'm having a bit of problem getting the application react well to all recoverable errors. Specifically, I'd like the application to handle properly the case of proxy authentication.
In HTTP, it's simple: make a request, get a "407" HTTP response code, prompt for user name/password and repeat until you ether go through or the user press "cancel".
With BITS, it's not that simple. I don't get the HTTP status code. I get a couple of codes: the context (which should be BG_ERROR_CONTEXT_REMOTE_FILE in my case) and an "ErrorCode" that is supposed to depend on the context.
If I request the textual description of the error through GetErrorDescription, I get the correct "407 proxy authentication require" text. But the error code I have is 0x80190197 which is nowhere near 407.
So, does anyone know where I can get a full list of the BITS error code ? Failing that, partial list with the most common errors would be nice.
0x80190197 is not strictly speaking a BITS error, it's an HTTP stack error. The list is available here: Errors (019) FACILITY_HTTP
I recently recorded a test script in Jmeter intended for use as a load test script (using this handy set of instructions. The recording itself worked great and I even figured out how to grab and parametrize the session ids and timestamps. However, if I run the recorded steps just as they were recorded some of them don't work -- they generate "500--Server encountered and internal error ...nested exception is java.lang.NullPointerException" The failing steps are all Ajax calls that populate sidebar elements. If I copy the request GET call (Request tab, ViewResultsTree) and paste it into a browser I get the exact same error. Do I need to record my script differently, or hand-code the ajax calls? Other, earlier steps work correctly and send the expected POST data, so it isn't the application under test or forgotten proxy settings. Currently running against Firefox 3.6.10
Any suggestions on how I can debug this would be greatly appreciated.
The first thing I'd do is determine if the java.lang.NullPointerException is happening on the client side (JMeter) or on your server. If it is happening in JMeter, than something is terribly wrong with either your script or with JMeter.
But assuming that the error is encountered on your server, then looking into the cause of the exception may shed light on what is wrong with the request issued by JMeter. Do you have access to the code where the exception is thrown?
I would also recommend comparing the request in the recording with the request that generated the error. You may need to determine which parts of the request are session-specific and ensure those fields are populated correctly.
It sounds like Jmeter isn't executing the AJAX calls, and this can be fine depending on your site. Can you simply do an HTTP request to get the pages the AJAX calls populate?
I would recommend reading this post, as it looks pretty good.
I've seen that situation caused by a few things:
a page is required to load and be cached BEFORE making the failing request;
the failing page needs to automatically redirected to work properly;
the failing page has sub-requests JMeter failed to record. Devs can help with this.
Hope this helps.