You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Steffen Heil (Mailinglisten)" <li...@steffen-heil.de> on 2012/10/10 13:55:18 UTC
WebSockets and HTTPS problems
Hi
We have a web application that makes more and more use of websockets.
(In fact we emulate websockets with comet servlets for older browsers and
want to use real websockets for current ones.)
We implemented our websocket support using tomcat 7.0.30 and a servlet
extending org.apache.catalina.websocket.WebSocketServlet.
(Meanwhile we updated to 7.0.32 but no improvement.)
That worked very well with IE10, FF and Chrome using http/ws.
But as soon as we switched to https/wss, we have the very same problem in
all those browsers:
The socket connects and the server sends data to the client, which gets
processed correctly, but then after a few short messages or some very short
time (<1s), the connection breaks.
I did some testing using 'stunnel' in front of tomcat and that worked. So
the problem cannot be client-based.
This leaves two possible causes:
a) A configuration problem in my tomcat instance.
b) A bug in tomcat.
By conf/server.xml is rather short [1], my conf/context.xml and my
conf/web.xml are empty (except for the root node, of course).
Do you see any error in my configuration? What can I do to debug this?
I tried to enable logging in tomcat [2], but it seems that did not suffice
to make tomcat more verbose...
Maybe I misunderstood the logging configuration.
Any help would be much appreciated...
Regards,
Steffen
[1] server.xml
----------------------------------------------------------------------------
-------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener
className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<Service name="XXXService">
<Executor name="XXXExecutor" namePrefix="XXX-exec-"
maxThreads="150" minSpareThreads="4" />
<Connector executor="XXXExecutor" port="80"
protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000" redirectPort="443" />
<Connector executor="XXXExecutor" port="8443"
protocol="org.apache.coyote.http11.Http11NioProtocol"
SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" connectionTimeout="20000"
keystoreFile="../https.p12" keystorePass="YYY"
keystoreType="PKCS12" URIEncoding="UTF-8" />
<Engine name="XXXEngine" defaultHost="XXXHost">
<Host name="XXXHost" appBase="webapps"
unpackWARs="false" autoDeploy="false" createDirs="false">
<Context path="" docBase="../../full"
cookies="false">
<Loader className="ZZZ.DevLoader"
reloadable="true" />
</Context>
</Host>
</Engine>
</Service>
</Server>
----------------------------------------------------------------------------
-------------------------------------
[2] logging.properties
----------------------------------------------------------------------------
-------------------------------------
handlers = java.util.logging.ConsoleHandler
.handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter
org.apache.coyote.http11.Http11NioProtocol.level = ALL
org.apache.catalina.core.ContainerBase.[XXXEngine].[XXXHost].level = ALL
org.apache.catalina.core.ContainerBase.[XXXEngine].[XXXHost].handlers =
org.apache.juli.FileHandler
----------------------------------------------------------------------------
-------------------------------------
Re: AW: AW: AW: WebSockets and HTTPS problems
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Steffen,
On 10/11/12 11:36 AM, Steffen Heil (Mailinglisten) wrote:
>> See if this fixes if for you:
>> http://people.apache.org/~markt/dev/tomcat-7/v7.0.33-r1397089/apache-
>>
>>
tomcat-7.0.33-r1397089.tar.gz
>
> Preliminary tests look promising. Everything worked (using a few
> single click tests so far).
>
> Thanks!
>
>
>> This is not an official release. Use it at your own risk.
>
> Understood. Is there any reason to expect this version to be in any
> way worse than 7.0.32?
>
> Is there any estimation, when a new release might happen? (No urge,
> just asking)
Tomcat 7.0.x releases have been roughly once per month, and we just
had one this week. It's reasonable to expect at least one more before
the end of the year and perhaps two.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iEYEARECAAYFAlB28qoACgkQ9CaO5/Lv0PDxbwCgwSs5SjM3Da9vgCRKuA9SDPE7
S3kAniSDm/l/oHEe8CYAcm7xVtZTcCoi
=T53X
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
AW: AW: AW: WebSockets and HTTPS problems
Posted by "Steffen Heil (Mailinglisten)" <li...@steffen-heil.de>.
Hi
> See if this fixes if for you:
> http://people.apache.org/~markt/dev/tomcat-7/v7.0.33-r1397089/apache-
> tomcat-7.0.33-r1397089.tar.gz
Preliminary tests look promising.
Everything worked (using a few single click tests so far).
Thanks!
> This is not an official release. Use it at your own risk.
Understood.
Is there any reason to expect this version to be in any way worse than
7.0.32?
Is there any estimation, when a new release might happen?
(No urge, just asking)
> I'll take it down again in a few days.
As for me, you may already do so.
> Any feedback appreciated.
Again, so far everything worked.
We will test it a lot more in the next days and I will report back.
Thanks again,
Steffen
Re: AW: AW: WebSockets and HTTPS problems
Posted by Mark Thomas <ma...@apache.org>.
Konstantin Kolinko <kn...@gmail.com> wrote:
>2012/10/11 Mark Thomas <ma...@apache.org>:
>> On 10/10/2012 19:57, Mark Thomas wrote:
>>> On 10/10/2012 19:51, Steffen Heil (Mailinglisten) wrote:
>>>> Hi
>>>>
>>>>> I just took a look at this. The examples work out of the box for
>HTTPS
>>>> with
>>>>> BIO but not with NIO. This looks like a Tomcat bug at this point.
>>>>> I'll take a look.
>>>>
>>>> What would I need to do to switch to BIO for now?
>>>
>>> Change the protocol attribute for your connector. See the docs.
>>>
>>>> And does Comet work with BIO?
>>>
>>> No, but APR does. ( I haven't tested APR, HTTPS and WebSocket yet).
>>>
>>> If you can hang on for a few hours, I might have a fix for you.
>>
>> See if this fixes if for you:
>>
>http://people.apache.org/~markt/dev/tomcat-7/v7.0.33-r1397089/apache-tomcat-7.0.33-r1397089.tar.gz
>>
>> This is not an official release. Use it at your own risk. I'll take
>it
>> down again in a few days.
>>
>
>Mark, I see you committed the fix to trunk in
>http://svn.apache.org/viewvc?view=revision&revision=1397086
>
>but I do not see such commit for 7.0.x (only a changelog update in
>r1397089).
>What am I missing?
Probably that I did the merge but forgot the commit. Ill check when I turn my desktop back on.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: AW: AW: WebSockets and HTTPS problems
Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/10/11 Mark Thomas <ma...@apache.org>:
> On 10/10/2012 19:57, Mark Thomas wrote:
>> On 10/10/2012 19:51, Steffen Heil (Mailinglisten) wrote:
>>> Hi
>>>
>>>> I just took a look at this. The examples work out of the box for HTTPS
>>> with
>>>> BIO but not with NIO. This looks like a Tomcat bug at this point.
>>>> I'll take a look.
>>>
>>> What would I need to do to switch to BIO for now?
>>
>> Change the protocol attribute for your connector. See the docs.
>>
>>> And does Comet work with BIO?
>>
>> No, but APR does. ( I haven't tested APR, HTTPS and WebSocket yet).
>>
>> If you can hang on for a few hours, I might have a fix for you.
>
> See if this fixes if for you:
> http://people.apache.org/~markt/dev/tomcat-7/v7.0.33-r1397089/apache-tomcat-7.0.33-r1397089.tar.gz
>
> This is not an official release. Use it at your own risk. I'll take it
> down again in a few days.
>
Mark, I see you committed the fix to trunk in
http://svn.apache.org/viewvc?view=revision&revision=1397086
but I do not see such commit for 7.0.x (only a changelog update in r1397089).
What am I missing?
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: AW: AW: WebSockets and HTTPS problems
Posted by Mark Thomas <ma...@apache.org>.
On 10/10/2012 19:57, Mark Thomas wrote:
> On 10/10/2012 19:51, Steffen Heil (Mailinglisten) wrote:
>> Hi
>>
>>> I just took a look at this. The examples work out of the box for HTTPS
>> with
>>> BIO but not with NIO. This looks like a Tomcat bug at this point.
>>> I'll take a look.
>>
>> What would I need to do to switch to BIO for now?
>
> Change the protocol attribute for your connector. See the docs.
>
>> And does Comet work with BIO?
>
> No, but APR does. ( I haven't tested APR, HTTPS and WebSocket yet).
>
> If you can hang on for a few hours, I might have a fix for you.
See if this fixes if for you:
http://people.apache.org/~markt/dev/tomcat-7/v7.0.33-r1397089/apache-tomcat-7.0.33-r1397089.tar.gz
This is not an official release. Use it at your own risk. I'll take it
down again in a few days.
Any feedback appreciated.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: AW: AW: WebSockets and HTTPS problems
Posted by Mark Thomas <ma...@apache.org>.
On 10/10/2012 19:51, Steffen Heil (Mailinglisten) wrote:
> Hi
>
>> I just took a look at this. The examples work out of the box for HTTPS
> with
>> BIO but not with NIO. This looks like a Tomcat bug at this point.
>> I'll take a look.
>
> What would I need to do to switch to BIO for now?
Change the protocol attribute for your connector. See the docs.
> And does Comet work with BIO?
No, but APR does. ( I haven't tested APR, HTTPS and WebSocket yet).
If you can hang on for a few hours, I might have a fix for you.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
AW: AW: WebSockets and HTTPS problems
Posted by "Steffen Heil (Mailinglisten)" <li...@steffen-heil.de>.
Hi
> I just took a look at this. The examples work out of the box for HTTPS
with
> BIO but not with NIO. This looks like a Tomcat bug at this point.
> I'll take a look.
What would I need to do to switch to BIO for now?
And does Comet work with BIO?
Regards,
Steffen
Re: AW: WebSockets and HTTPS problems
Posted by Mark Thomas <ma...@apache.org>.
On 10/10/2012 17:41, Steffen Heil (Mailinglisten) wrote:
> Hi
>
>
>> Check to see if the WebSocket examples that ship with Tomcat work with
>> your configuration. If they don't compare the differences between the
>> default configuration and you configuration to and find the change that
>> breaks stuff.
>
> First, thanks for the reply.
>
> I downloaded tomcat 7.0.32 again and replaced the connectors in the
> configuration with my own (minus the executor references).
> Nothing else was changed.
>
> The WebSocket chat example works with http on port 80, but not on port 8443.
> It says:
>> Info: WebSocket connection opened.
>> * Guest3 has joined.
>
> And as soon as I send something:
>> Info: WebSocket closed.
>
> The message does not get back to the client.
> So the problem must in my connector configuration:
I just took a look at this. The examples work out of the box for HTTPS
with BIO but not with NIO. This looks like a Tomcat bug at this point.
I'll take a look.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
AW: WebSockets and HTTPS problems
Posted by "Steffen Heil (Mailinglisten)" <li...@steffen-heil.de>.
Hi
> Check to see if the WebSocket examples that ship with Tomcat work with
> your configuration. If they don't compare the differences between the
> default configuration and you configuration to and find the change that
> breaks stuff.
First, thanks for the reply.
I downloaded tomcat 7.0.32 again and replaced the connectors in the
configuration with my own (minus the executor references).
Nothing else was changed.
The WebSocket chat example works with http on port 80, but not on port 8443.
It says:
> Info: WebSocket connection opened.
> * Guest3 has joined.
And as soon as I send something:
> Info: WebSocket closed.
The message does not get back to the client.
So the problem must in my connector configuration:
<Connector port="80"
protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000" redirectPort="443" />
<Connector port="8443"
protocol="org.apache.coyote.http11.Http11NioProtocol"
SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" connectionTimeout="20000"
keystoreFile="../https.p12" keystorePass="XXX"
keystoreType="PKCS12" URIEncoding="UTF-8" />
I don't see it; how can this happen?
What can I do to debug this any further?
Best regards,
Steffen
Re: WebSockets and HTTPS problems
Posted by Mark Thomas <ma...@apache.org>.
On 10/10/2012 12:55, Steffen Heil (Mailinglisten) wrote:
> Do you see any error in my configuration?
Nothing jumps out at me.
> What can I do to debug this?
I'd use Wireshark.
> I tried to enable logging in tomcat [2], but it seems that did not suffice
> to make tomcat more verbose...
> Maybe I misunderstood the logging configuration.
If something goes wrong I'd expect to see an error in logs with the
default logging configuration.
> Any help would be much appreciated...
Check to see if the WebSocket examples that ship with Tomcat work with
your configuration. If they don't compare the differences between the
default configuration and you configuration to and find the change that
breaks stuff.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org