# TLS distribution: unexpected message: {'EXIT',\<0.178.0\>,shutdown}

**URL:** <https://erlangforums.com/t/tls-distribution-unexpected-message-exit-0-178-0-shutdown/2339>\
**Category:** Questions / Help\
**Tags:** erlang, distributed-erlang\
**Created:** [February 3, 2023, 6:20pm UTC](https://erlangforums.com/t/tls-distribution-unexpected-message-exit-0-178-0-shutdown/2339 "2023-02-03T18:20:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lukebakken](https://erlangforums.com/user_avatar/erlangforums.com/lukebakken/32/259_2.png) [@lukebakken](https://erlangforums.com/u/lukebakken)\
**Post date:** [February 3, 2023, 6:20pm UTC](https://erlangforums.com/t/tls-distribution-unexpected-message-exit-0-178-0-shutdown/2339/1 "2023-02-03T18:20:18Z")

</div>

Hi everyone,

We had a RabbitMQ user report an interesting log message during shutdown, which can be seen here:

> **[rabbitmqctl shutdown logs errors regards dynamic ssl connections · Discussion...](https://github.com/rabbitmq/rabbitmq-server/discussions/7182)**
>
> Hello RabbitMQ team, I'm currently testing RabbitMQ 3.11.x and I'm getting error logs when using rabbitmqctl shutdown. I'm using the standard SSL config with tlsv1.2 and tlsv1.3 and did...

What I find odd is that the `{'EXIT',<0.178.0>,shutdown}` message didn’t match the case clause here:

> <https://github.com/erlang/otp/blob/OTP-25.1.2/lib/ssl/src/inet_tls_dist.erl#L243>

Note that Erlang 25.1.2 is being used.

Thanks for any insight, and apologies if I’m missing something obvious!

---

<div class="post-metadata">

**Author:** ![mmin](https://erlangforums.com/user_avatar/erlangforums.com/mmin/32/2193_2.png) [@mmin](https://erlangforums.com/u/mmin)\
**Post date:** [February 3, 2023, 7:49pm UTC](https://erlangforums.com/t/tls-distribution-unexpected-message-exit-0-178-0-shutdown/2339/2 "2023-02-03T19:49:44Z")

</div>

> [@lukebakken](#):
>
> What I find odd is that the `{'EXIT',<0.178.0>,shutdown}` message didn’t match the case clause here:

It didn’t match because `HandshakePid` is already bound in the function argument, but this pid is not the one who is asking the process to shutdown. The process is asked to shutdown by its supervisor, which is not `HandshakePid`. Also, this process has `trap_exit` set to `true` so exits are passed as messages to it.

So, every time the supervisor is shutting down this process, this warning will be generated I guess? I don’t know if this is wanted behavior.

---

<div class="post-metadata">

**Author:** ![lukebakken](https://erlangforums.com/user_avatar/erlangforums.com/lukebakken/32/259_2.png) [@lukebakken](https://erlangforums.com/u/lukebakken)\
**Post date:** [February 3, 2023, 9:29pm UTC](https://erlangforums.com/t/tls-distribution-unexpected-message-exit-0-178-0-shutdown/2339/3 "2023-02-03T21:29:49Z")

</div>

Thanks. Someday using a bound variable later on won’t trip me up, but not today! 🙃

---

<div class="post-metadata">

**Author:** ![max-au](https://erlangforums.com/user_avatar/erlangforums.com/max-au/32/1627_2.png) [@max-au](https://erlangforums.com/u/max-au)\
**Post date:** [February 4, 2023, 4:19am UTC](https://erlangforums.com/t/tls-distribution-unexpected-message-exit-0-178-0-shutdown/2339/4 "2023-02-04T04:19:42Z")

</div>

I believe it existed since OTP 24, and it is [my fault](https://github.com/erlang/otp/pull/2654).

This is benign message saying “a new TLS connection has been accepted while the node was shutting down, before handshake succeeded”. Essentially it’s noise (we suppressed it in the logger filter, and that’s why I forgot to follow it up).

IIRC the fix is to replace `Reason =/= normal andalso` with `Reason =/= normal andalso Reason =/= shutdown andalso`. I had it somewhere, thanks for a reminder. I’ll fire up a PR to remove the useless message.

In the meantime, you may just ignore the message, or suppress it in the logger handler.

---

<div class="post-metadata">

**Author:** ![starbelly](https://erlangforums.com/user_avatar/erlangforums.com/starbelly/32/209_2.png) [@starbelly](https://erlangforums.com/u/starbelly)\
**Post date:** [February 6, 2023, 2:58am UTC](https://erlangforums.com/t/tls-distribution-unexpected-message-exit-0-178-0-shutdown/2339/5 "2023-02-06T02:58:22Z")

</div>

Or we get the pin op 🙂

---

<div class="post-metadata">

**Author:** ![max-au](https://erlangforums.com/user_avatar/erlangforums.com/max-au/32/1627_2.png) [@max-au](https://erlangforums.com/u/max-au)\
**Post date:** [February 6, 2023, 4:29am UTC](https://erlangforums.com/t/tls-distribution-unexpected-message-exit-0-178-0-shutdown/2339/6 "2023-02-06T04:29:41Z")

</div>

In that case pin would work against the intent of the diff. If someone asks me “what do you want to change in the base language” and ask “do you want a pinning operator”, I’d say “nope, please, but - please - let’s have a real string() class that’s not a list of characters, but a binary, probably UTF8/16/…”

---

<div class="post-metadata">

**Author:** ![starbelly](https://erlangforums.com/user_avatar/erlangforums.com/starbelly/32/209_2.png) [@starbelly](https://erlangforums.com/u/starbelly)\
**Post date:** [February 6, 2023, 6:58pm UTC](https://erlangforums.com/t/tls-distribution-unexpected-message-exit-0-178-0-shutdown/2339/7 "2023-02-06T18:58:52Z")

</div>

Ahh I see. I didn’t see your reply, and even if I did, I probably still would have read it wrong, tricky little chunk.

But yes, agreed. There was discussion on slack not terribly long ago about migrating to binaries as the default such that `""` becomes binary syntax using the new feature pragma. That’s another topic unto itself but yeah.

Thanks for your work in all the patches you submit to OTP 🙂

---

<div class="post-metadata">

**Author:** ![max-au](https://erlangforums.com/user_avatar/erlangforums.com/max-au/32/1627_2.png) [@max-au](https://erlangforums.com/u/max-au)\
**Post date:** [February 7, 2023, 5:58am UTC](https://erlangforums.com/t/tls-distribution-unexpected-message-exit-0-178-0-shutdown/2339/8 "2023-02-07T05:58:57Z")

</div>

Submitted [Do not emit "unexpected" message on shutdown by max-au · Pull Request #6810 · erlang/otp · GitHub](https://github.com/erlang/otp/pull/6810)

While “unexpected message” fix was, as I said before, trivial, looking into `child_terminated` errors led me into a rabbit hole. Well, it always happened to me. Looks like a 5-years old bug surfaced with the new supervisor goodness, “significant children” feature.

> That naming made my wife staring scared at me, “does that mean there are some _insignificant_ children?! What kind of parent are you” and I had no choice but to quite Shrek, “One of a kind”.

---

<div class="post-metadata">

**Author:** ![nzok](https://erlangforums.com/letter_avatar_proxy/v4/letter/n/4af34b/32.png) [@nzok](https://erlangforums.com/u/nzok)\
**Post date:** [February 7, 2023, 11:28am UTC](https://erlangforums.com/t/tls-distribution-unexpected-message-exit-0-178-0-shutdown/2339/9 "2023-02-07T11:28:34Z")

</div>

I’ve been saying this since 1980, when I discovered that  
a text editor a friend of mine had written in PL/I and  
was selling for $50 a copy could be written in about 1/4  
as many pages of C precisely because C _didn’t_ have a  
string type and PL/I _did_ :

STRINGS ARE WRONG.

Or as Alan Perlis put it

“The string is a stark data structure  
and everywhere it is used there is much  
duplication of process.”

What he didn’t say, but could have, is that  
much of that duplication of process will be  
both slow and buggy.

Strings are _perfect_ for briefly holding onto  
text you got from somewhere else and will pass  
on like a hot potato having done as little  
processing as possible. Otherwise, if you hold  
any non-trivial amount of data as strings, you  
are doing it wrong.

(By the way, if you like horror stories, read the  
Unicode specification. If you really enjoy tales  
of the crypt, look into the history of it and the  
way they have flip-flipped on core design issues  
a couple of times. Even “move forward one thingy  
in this string” is a nightmare of “but what does  
that actually MEAN?”)
