bryan-emmanuel / Hydra

database connection api
1 stars 0 forks source link

Strange Exception #4

Open dfarina opened 11 years ago

dfarina commented 11 years ago

I get an exception thrown for issuing a request with the old "EXAMPLE" Unidata routine:

java.net.SocketException: Software caused connection abort: recv failed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:166)
    at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:90)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:281)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:92)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:62)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
    at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:715)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:520)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
    at com.fig.sciquest.po.server.util.HydraClientTest.getHttpEntity(HydraClientTest.java:88)
    at com.fig.sciquest.po.server.util.HydraClientTest.subroutine(HydraClientTest.java:283)
    at com.fig.sciquest.po.test.HydraTestUtils.demoTest(HydraTestUtils.java:275)
    at com.fig.sciquest.po.test.HydraTestUtils.main(HydraTestUtils.java:18)

This is thrown when the following string is passed in as an argument:

07/31/2013:@FM:0303349:@FM:AP:@FM:BW:@FM:cottonl:@FM:07/31/2013:@FM:N3:@FM:583851:@FM:583851:@FM:O:@FM:Attn: Lisa Cotton:@FM:Newtown Bucks Campus:@VM:275 Swamp Road:@FM:Newtown:@FM:PA:@FM:18940:@FM:BCCC ref# 60513uote # 3171-6259-1repared by Aaron Steigelmanhip Attn: D.Donley STEM Dept:@FM:FISHER SCIENTIFIC:@FM:07/31/2013:@FM:N:@FM:07/31/2013:@FM:PS000024:@FM::@FM:41731449:@RM:Reagent Alcohol 95% CAS# 64-17-5:@FM:07/31/2013:@FM:cottonl:@FM:107096235:@FM:2000:@FM:EA:@FM:2619:@FM:5238:@VM:2000:@SM:11152005201100:@SM:5238:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Sodium Carbonate CAS # 497-19-8:@FM:07/31/2013:@FM:cottonl:@FM:107096236:@FM:1000:@FM:EA:@FM:860:@FM:860:@VM:1000:@SM:11152005201100:@SM:860:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of colored threads wm:@FM:07/31/2013:@FM:cottonl:@FM:107096260:@FM:14000:@FM:EA:@FM:327:@FM:4578:@VM:14000:@SM:11152005201100:@SM:4578:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of grantia ls:@FM:07/31/2013:@FM:cottonl:@FM:107096261:@FM:8000:@FM:EA:@FM:430:@FM:3447:@VM:8000:@SM:11152005201100:@SM:3447:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of onion root tip mitosis:@FM:07/31/2013:@FM:cottonl:@FM:107096262:@FM:8000:@FM:EA:@FM:524:@FM:4192:@VM:8000:@SM:11152005201100:@SM:4192:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of Gloecapsa wm:@FM:07/31/2013:@FM:cottonl:@FM:107096263:@FM:2000:@FM:EA:@FM:418:@FM:836:@VM:2000:@SM:11152005201100:@SM:836:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of Oscillatoria wm:@FM:07/31/2013:@FM:cottonl:@FM:107096264:@FM:2000:@FM:EA:@FM:415:@FM:830:@VM:2000:@SM:11152005201100:@SM:830:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of Anabaena wm:@FM:07/31/2013:@FM:cottonl:@FM:107096265:@FM:2000:@FM:EA:@FM:363:@FM:726:@VM:2000:@SM:11152005201100:@SM:726:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of Aspergillus wm:@FM:07/31/2013:@FM:cottonl:@FM:107096266:@FM:2000:@FM:EA:@FM:393:@FM:786:@VM:2000:@SM:11152005201100:@SM:786:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of Balantidium coli Cyst smear:@FM:07/31/2013:@FM:cottonl:@FM:107096267:@FM:20000:@FM:EA:@FM:716:@FM:14319:@VM:20000:@SM:11152005201100:@SM:14319:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of Simple Columnar epithelium sec:@FM:07/31/2013:@FM:cottonl:@FM:107096268:@FM:4000:@FM:EA:@FM:429:@FM:1716:@VM:4000:@SM:11152005201100:@SM:1716:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of Simple cuboidal epithelium sec:@FM:07/31/2013:@FM:cottonl:@FM:107096269:@FM:4000:@FM:EA:@FM:458:@FM:1832:@VM:4000:@SM:11152005201100:@SM:1832:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of scalp sec:@FM:07/31/2013:@FM:cottonl:@FM:107096270:@FM:3000:@FM:EA:@FM:645:@FM:1935:@VM:3000:@SM:11152005201100:@SM:1935:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Prepared slides of Giant Multi-polar neurons:@FM:07/31/2013:@FM:cottonl:@FM:107096271:@FM:12000:@FM:EA:@FM:678:@FM:8136:@VM:12000:@SM:11152005201100:@SM:8136:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Bio-hazard Medical waste bags red 23X23:@FM:07/31/2013:@FM:cottonl:@FM:107096272:@FM:2000:@FM:CS:@FM:1265:@FM:2530:@VM:2000:@SM:11152005201100:@SM:2530:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:100X15mm polystyrene Petri Dishes sterile 500/case:@FM:07/31/2013:@FM:cottonl:@FM:107096273:@FM:12000:@FM:CS:@FM:9952:@FM:119424:@VM:12000:@SM:11152005201100:@SM:119424:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Extech exstick ORP meter MFG # RE300:@FM:07/31/2013:@FM:cottonl:@FM:107096274:@FM:2000:@FM:EA:@FM:10687:@FM:21374:@VM:2000:@SM:11152005201100:@SM:21374:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Extech Pocket IR Thermometer (vendor cat# IR201A)Non Catalogue Item:@FM:07/31/2013:@FM:cottonl:@FM:107096275:@FM:8000:@FM:EA:@FM:4874:@FM:38992:@VM:8000:@SM:11152005201100:@SM:38992:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Wildco Fieldmaster student secchi disc MFG # 78-101:@FM:07/31/2013:@FM:cottonl:@FM:107096276:@FM:2000:@FM:EA:@FM:2576:@FM:5152:@VM:2000:@SM:11152005201100:@SM:5152:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Preserved crayfish10/Pack:@FM:07/31/2013:@FM:cottonl:@FM:107096277:@FM:2000:@FM:PK:@FM:874:@FM:1748:@VM:2000:@SM:11152005201100:@SM:1748:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Preserved Mussels 4-5 10/pack:@FM:07/31/2013:@FM:cottonl:@FM:107096278:@FM:2000:@FM:PK:@FM:1206:@FM:2412:@VM:2000:@SM:11152005201100:@SM:2412:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Preserved Grasshoppers 10/jar:@FM:07/31/2013:@FM:cottonl:@FM:107096279:@FM:1000:@FM:EA:@FM:388:@FM:388:@VM:1000:@SM:11152005201100:@SM:388:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Preserved Starfish:@FM:07/31/2013:@FM:cottonl:@FM:107096280:@FM:10000:@FM:EA:@FM:1538:@FM:15380:@VM:10000:@SM:11152005201100:@SM:15380:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:10-13 Fetal pigs double injected individually packed:@FM:07/31/2013:@FM:cottonl:@FM:107096281:@FM:80000:@FM:EA:@FM:1969:@FM:157520:@VM:80000:@SM:11152005201100:@SM:157520:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Sheep brains with Dura matter 10/pack:@FM:07/31/2013:@FM:cottonl:@FM:107096282:@FM:5000:@FM:PK:@FM:10500:@FM:52500:@VM:5000:@SM:11152005201100:@SM:52500:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Bovine spinal cord sections:@FM:07/31/2013:@FM:cottonl:@FM:107096283:@FM:1000:@FM:CS:@FM:69188:@FM:69188:@VM:1000:@SM:11152005201100:@SM:69188:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18:@RM:Pigs Kidneys double kidney double injected:@FM:07/31/2013:@FM:cottonl:@FM:107096284:@FM:70000:@FM:EA:@FM:683:@FM:47810:@VM:70000:@SM:11152005201100:@SM:47810:@SM:10000:@FM:O:@FM:07/31/2013:@FM:15:45:18
dfarina commented 11 years ago

When I call the toString() on the HttpResponse after executing the request, I get this:

HTTP/1.1 400 Bad Request [Server: Apache-Coyote/1.1, Transfer-Encoding: chunked, Date: Wed, 07 Aug 2013 17:36:14 GMT, Connection: close]

bryan-emmanuel commented 11 years ago

Off the top of my head... wrong number of arguments to the subroutine. It's tough to say without knowing what's happening on the server side. It appears that you're just sending one huge argument. Does the subroutine signature only have a single argument? It's also possible that the request may exceed some size restriction in Unidata. Anything in the Hydra server logs?

dfarina commented 11 years ago

See above. This should actually be in the HydraClient repo, since it's technically not even getting to Hydra.

Edit: And no, nothing generates in the Tomcat logs.

dfarina commented 11 years ago

Actually, I just looked at the access log. I have a whole lot of these...

IP.ADDRESS.SECRET - - [07/Aug/2013:10:35:52 -0700] "POST null null" 400 -
dfarina commented 11 years ago

To answer your questions above, I can send through larger requests without a problem, and if we skip over going through Tomcat, the Unidate routine successfully processes the request. Also, there is one giant argument, but 4 arguments come back. So there's something wrong with communication... it is possibly Tomcat's fault. Maybe it disagrees that this is a valid request?

bryan-emmanuel commented 11 years ago

Alright, let's back up... Subroutine calls have worked before, right? If they've worked on other servers, but not this, how do the configurations compare, port, host, etc? Maybe a variation is overlooked in building the request. If they've worked on this server, but not for this subroutine, how do the calls compare between those that have worked and this one?

Thanks!

dfarina commented 11 years ago

Well, everything works perfectly except for the string above and one other one. All other subroutine requests are dandy. I even tried getting rid of all the strange characters like "#" in the string to no avail.

bryan-emmanuel commented 11 years ago

OK, so were dealing with edge cases at this point. I wonder if something isn't being encoded in an acceptable way. Have any successful requests been made to the same subroutine on this server? We should know that there's nothing necessarily wrong with the subroutine. We might have to start comparing the content to track down the problem. I think you're on the right track with the "#"'s. On the other hand, what if the problem isn't what's being sent, but what's being returned.

dfarina commented 11 years ago

I have confirmed that the request that produce errors aren't even reaching the deployed Hydra instance, and Tomcat is instantly rejecting them with a 400 error above back to HydraClient.

The crazy thing is if I split up the request into 4 separate requests, it works.

dfarina commented 11 years ago

Okay, I finally found a way to hit the Hydra instance being served.

A status code of 400 means that the http request is malformed, or otherwise doesn't obey protocol. Since I cannot determine why, I tried sticking the packed arguments array into a StringEntity instead of dumping it as a parameter in the URL. On the server side, the string has to be extracted from the request's InputStream, but it looks like this is the solution to the problem.

To be honest, what I'm about to do will qualify as a hack, because I'm only concerned about a single API call in Hydra, but I will commit the code when I'm finished. This will also be a fundamental change in the communication between the Client and Server instances, so I don't know how you feel about adopting it.