SSLEngine closed already

3,726 views
Skip to first unread message

Henri Tremblay

unread,
Jul 5, 2016, 5:09:01 PM7/5/16
to Gatling User Group
Hi,

When running my tests (a bunch of users hammering a server without pause), after a while (usually about 150 seconds), I get this error "SSLEngine closed already". So
  •  None before a precise moment
  • A bunch at a given moment
  • Then some every 5 seconds
So far, I thought it was my server that was having a problem but I'm not so sure anymore.

If I look at the Netty code (https://searchcode.com/codesearch/view/10525295/), it looks more like the server that decides to close the connexion and then the client that should just reopen one. I'm guessing a bit here.

So it shouldn't be a real KO. It's some kind of normal behavior.

Strangely, when using Apache Benchmark, I also have some similar errors on stdout but then Apache Benchmark doesn't consider it to be a failure in the final report.

Am I making any sense? Can someone explain the error?

Thanks,
Henri

Stéphane LANDELLE

unread,
Jul 6, 2016, 4:07:56 AM7/6/16
to gat...@googlegroups.com
Salut Henri,

Do you some kind of reproducer, please?

Thanks,

Stéphane Landelle
GatlingCorp CEO


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Henri Tremblay

unread,
Jul 6, 2016, 8:04:13 AM7/6/16
to gat...@googlegroups.com
The script is quite basic

class MySimulation extends Simulation {

val users = Integer.getInteger("users", 1).toInt
val ramp = Integer.getInteger("ramp", 1).toInt
val duration = Integer.getInteger("duration", 10).toLong
val baseUrl = System.getProperty("baseUrl")

val httpProtocol = http
.baseURL(baseUrl)
.doNotTrackHeader("1")
.disableCaching
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.49 Safari/537.36")
.acceptHeader("text/html,application/xhtml+xml,application/xml;")
.acceptEncodingHeader("gzip, deflate, sdch, br")

val scn = scenario("test")
.during(duration seconds) {
exec(http("fake")
.get("/img.png"))
}

setUp(scn.inject(heavisideUsers(users) over(ramp seconds))).protocols(httpProtocol)
}
It hits an https url (load balancer in front handling the SSL termination and then balancing on two servers, with a new https connection).

I will try to reproduce locally.


--
You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/vB3pzHYY8-s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.

Henri Tremblay

unread,
Jul 7, 2016, 11:09:19 AM7/7/16
to Gatling User Group
But in fact, I'm pretty sure I won't be able to reproduce out of my environment. If it can be of any use, the LB is managing the keep-alive correctly, does SSL session caching but do not support SSL tickets.

So question is: "How is the Netty piece of code below handled by Gatling?"

Right now, I fell that if the connection is closed, the client should recreate it without complaining. Because it's normal to get a closed connection after a while (I kinda think/guess). WDYT?

                SSLEngineResult result = wrap(engine, buf, out);

                if (!buf.isReadable()) {
                    buf.release();
                    promise = (ChannelPromise) pending.recycleAndGet();
                    pendingUnencryptedWrites.remove();
                } else {
                    promise = null;
                }

                if (result.getStatus() == Status.CLOSED) {
                    // SSLEngine has been closed already.
                    // Any further write attempts should be denied.
                    for (;;) {
                        PendingWrite w = pendingUnencryptedWrites.poll();
                        if (w == null) {
                            break;
                        }
                        w.failAndRecycle(SSLENGINE_CLOSED);
                    }
                    return;
                }



Stéphane LANDELLE

unread,
Jul 8, 2016, 2:16:07 AM7/8/16
to gat...@googlegroups.com
There's such a mechanism implemented for retrying such failure, but it might not work in this case.
I'd need to be able to reproduce, and will only be able to investigate when I'm back to the office in 2 weeks.

Stéphane Landelle
GatlingCorp CEO


Stéphane LANDELLE

unread,
Jul 8, 2016, 2:38:07 AM7/8/16
to gat...@googlegroups.com
Also, if you have some exceptions in the logs, it would help.

Stéphane Landelle
GatlingCorp CEO


Henri Tremblay

unread,
Jul 8, 2016, 10:53:43 AM7/8/16
to gat...@googlegroups.com
Sure. I will send you everything I have

--
You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/vB3pzHYY8-s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.

Stéphane LANDELLE

unread,
Jul 8, 2016, 1:32:47 PM7/8/16
to gat...@googlegroups.com
Please do :)

Stéphane Landelle
GatlingCorp CEO


Henri Tremblay

unread,
Jul 18, 2016, 11:54:33 AM7/18/16
to gat...@googlegroups.com
So the error is: j.n.s.SSLException: SSLEngine closed already

It is logged as a warning like this: 

11:39:10.971 [DEBUG] i.g.h.a.AsyncHandler - Request 'my-webfont.ttf' failed for user 86
javax.net.ssl.SSLException: SSLEngine closed already
11:39:10.973 [WARN ] i.g.h.a.ResponseProcessor - Request 'my-webfont.ttf' failed: j.n.s.SSLException: SSLEngine closed already
11:39:10.978 [DEBUG] i.g.h.a.ResponseProcessor -
>>>>>>>>>>>>>>>>>>>>>>>>>>
Request:
my-webfont.ttf: KO j.n.s.SSLException: SSLEngine closed already
=========================
Session:
.... (the session)
=========================
HTTP request:
headers=
Accept: */*
DNT: 1
Accept-Language: en-CA,en;q=0.8,fr;q=0.6
Accept-Encoding: gzip, deflate, sdch, br
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.49 Safari/537.36
Cookie: ...
Host: site.com
=========================
HTTP response:

<<<<<<<<<<<<<<<<<<<<<<<<<

No stack trace when the log is enabled for errors

Muse Mekuria

unread,
Dec 29, 2016, 1:09:35 PM12/29/16
to Gatling User Group
Henri, I'm seeing the same issue. Did you figure this out?

Henri Tremblay

unread,
Dec 29, 2016, 3:30:46 PM12/29/16
to gat...@googlegroups.com
Sadly no. I never managed to get a fully reproductible use-case after the fact (not my fault, I wasn't there anymore). The root cause seemed to be the IDS that was closing connection but they should then have been recreated by gatling. 

To unsubscribe from this group and all its topics, send an email to gatling+unsubscribe@googlegroups.com.

yva

unread,
Mar 6, 2017, 7:20:47 PM3/6/17
to Gatling User Group
Hi
I have the same problem, have you found a
olution
Thanks

Henri Tremblay

unread,
Mar 6, 2017, 9:31:48 PM3/6/17
to gat...@googlegroups.com
No. I haven't. I tune the proxy that was causing issues and it disappeared. But that obviously isn't the solution from gatling side.

In my case, a load balancer was misbehaving and closing my ssl connections

yva

unread,
Mar 7, 2017, 3:02:09 PM3/7/17
to Gatling User Group
Thanks

Kapil

unread,
Mar 15, 2018, 4:21:07 PM3/15/18
to Gatling User Group
Hi Henri

I am also getting the same error and raised it in gatling forum but no reply so thought to check with you as well if you managed to resolve that or now. if yes then how? it looks like issue from Gatling side?

Henri Tremblay

unread,
Mar 15, 2018, 4:30:32 PM3/15/18
to gat...@googlegroups.com
No. As I said, something was closing the connection. But it was allowed to. We reconfigured the appliance. But Gatling wasn't recreating the connection for some reason.

Stéphane LANDELLE

unread,
Mar 15, 2018, 4:57:12 PM3/15/18
to gat...@googlegroups.com
Again, here isn't much we can do without being able to reproduce.
The only time we saw this error, the frequency was 1/1,000,000 in customer environment so not something we could debug.

Stéphane Landelle
GatlingCorp CEO


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+unsubscribe@googlegroups.com.

Kapil

unread,
Mar 15, 2018, 6:30:26 PM3/15/18
to gat...@googlegroups.com
Yes Stephane, Exactly same thing in happening in my environment. out of 34000 transaction we got 1 SSLException error but because script is running continuous mode so other transactions are failing.

is there anyway in gatling to stop the iteration and start new iteration if any failure occurs ?

Henri Tremblay

unread,
Mar 15, 2018, 7:49:09 PM3/15/18
to gat...@googlegroups.com
If I recall correctly a way to reproduce would be to establish an SSL connection. Then to have the server cutting the connection because of an SSL connection timeout. Check if the client reconnects every time. 
Message has been deleted

Abisha Sahaya

unread,
May 31, 2018, 3:13:58 AM5/31/18
to Gatling User Group


Hi All, I am also facing the same problem . Anyone have solution for this issue.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/vB3pzHYY8-s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/vB3pzHYY8-s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages