infuriating heisenbug in Java/WAS 8.5 liberty profile on socket binding

余生长醉 提交于 2019-12-24 04:53:11

问题


I get socket bind error on Java 6/Websphere 8.5 (Liberty profile, a cut down, usable version of Websphere). When killing and starting app server immediately again I get:

[ERROR ] CWWKO0221E: TCP Channel defaultHttpEndpoint initialization did not succeed. The socket bind did not succeed for host * and port 9988. The port might already be in use.

This is because either Java or WAS have not released IPv6 sockets properly.

But, here's the snag: when I run WLP via strace (with -f option to track child processes), the bind error does not happen.

What is going on? Why can't I catch this via strace?

I can get around this problem by specifying soReuseAddress, but what worries me here is why / how to catch this problem via strace (without relying on dumb luck, that is) and why it's not working?


回答1:


You may find adding the soReuseAddr option to your httpEndpoint configuration helps, particularly on Linux platforms. For example,

<httpEndpoint id="defaultHttpEndpoint"
             host="*"
             httpPort="9080">
      <tcpOptions soReuseAddr="true" />
 </httpEndpoint>

It can take a while for the OS to release ports, despite the best attempts of the server, and this is particularly noticeable with Liberty, since it tends to bounce quickly.



来源:https://stackoverflow.com/questions/13934961/infuriating-heisenbug-in-java-was-8-5-liberty-profile-on-socket-binding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!