Fork me on GitHub
#immutant
<
2016-12-15
>
timgilbert16:12:29

Hi all, I'm seeing some peculiar Undertow errors, wonder if anyone has seen something similar?

timgilbert16:12:14

2016-12-15 16:30:15,890 [XNIO-1 task-1] ERROR io.undertow.request: UT005071: Undertow request failed HttpServerExchange{ GET / request {X-Real-IP=[xxxx], Accept=[*/*], X-Amzn-Trace-Id=[Root=1-5852c517-5e570c000e2261a46ec0e6a9], Accept-Encoding=[gzip, deflate], User-Agent=[HTTPie/0.9.6], Connection=[upgrade], X-Forwarded-Proto=[http], X-Forwarded-Port=[80], X-Forwarded-For=[yyyy, zzzz], Host=[]} response {Server=[undertow]}}
java.lang.ClassCastException: null

timgilbert16:12:21

I'm seeing this specifically when requesting an insecure page

tcrawley16:12:51

@timgilbert: is there a stack trace at all?

timgilbert16:12:10

I have immutant behind an AWS application load balancer which is termintating SSL and then forwarding to immutant

timgilbert16:12:03

When I request a secure page from the load balancer, everything is kosher. But when I request an insecure page, I get the above error in the logs

timgilbert16:12:37

Wondering if it's related to the Connection=[upgrade] bit or something

jcrossley316:12:35

@timgilbert are you saying there is no stack trace or you can't access the logs with the stack trace?

timgilbert16:12:26

There is no stack trace, like each http request outputs literally just the block of logs above

timgilbert16:12:13

All of this is working fine over http running on localhost, BTW, so it seems like possibly some stuff added from the load-balancer to the EC2 instance might be throwing a spanner into the works

tcrawley16:12:48

what version of immutant are you using?

timgilbert16:12:10

[org.immutant/web "2.1.5"]

tcrawley16:12:13

k, thanks. trying something locally to see if I can reproduce

timgilbert16:12:37

Cool, thanks. Let me know if there's info I can provide.

tcrawley16:12:51

well, that didn't work

tcrawley16:12:18

I thought maybe the presence of a Connection: upgrade without an Upgrade: header was triggering it, but no

timgilbert16:12:08

I do have some code that's specifically looking for http connections and redirecting them, maybe it's an obscure bug in there

tcrawley16:12:30

is this an uberjar, or are you running WildFly?

timgilbert16:12:33

Anyways, I'll keep hacking. Thanks for looking anyways

timgilbert16:12:57

This is an uberjar, running under a AWS Java SE Elastic Beanstalk environment

tcrawley16:12:16

I think there is a way to register an error handler - possibly the default one is what gives you the log message

tcrawley16:12:19

looking for that now

timgilbert17:12:48

Hmm, interesting

tcrawley17:12:09

line 202 is where your handler gets (eventually) called. If you could wrap your top-level handler in a try/catch, that might tell you something

tcrawley17:12:26

but there are probably other handlers in the chain that get called before your code, so the issue could be there as well

timgilbert17:12:43

I think I may have found a bug in my code actually, where some ring middleware was returning this:

(fn [request]
  (moved-permanently secure-url))
...instead of just (moved-permanently secure-url)

timgilbert17:12:23

Which maybe would explain the ClassCastException

timgilbert17:12:02

Will mess with it and let you know

tcrawley17:12:41

cool, I'm here to help if that doesn't fix it

timgilbert17:12:57

Ok, yes, that was indeed the problem. Thanks for your help!

timgilbert17:12:55

I obviously need to set up some better exception logging somewhere. I do see stack traces for most things, but this one just gave me the one line.