1

We have a web proxy running as a service. It's a straight-up EXE, within it is a packaged java application.

Sometimes, we get this in the log file the application generates, and the proxy stops working.

26-11-2013 09:42:48,661 [ServerThread] ERROR pe - Unable to start server java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365) at java.net.ServerSocket.bind(ServerSocket.java:319) at java.net.ServerSocket.(ServerSocket.java:185) at java.net.ServerSocket.(ServerSocket.java:141) at pe.a(Unknown Source) at oe.run(Unknown Source)

But the EXE happily keeps running. Is there any general way of making the EXE fail when this Java failure occurs, so that the Windows native ability to restart failed services kicks in? Obviously, if the software vendor has to build this in, there's no way you, gentle reader, would know the answer. I'm just wondering if there's a Java flag that I'm not aware of.

It looks like it was built with procrun, I think. I'm saying that based on running strings.exe on the connector.exe file.

I know that a more complete solution would be log-file monitoring, with alerting and possible automated remediation. That's not something that I can do today however.

2
  • 1
    The documentation suggests no way to implement this after the fact. It is possible that the --StartMethod used precludes communication with the host application. Even if you were to correct the propagation of the error in the procrun distribution, it would not help unless you had access to the unwrapped jar file.
    – Pekka
    Dec 1 '13 at 16:33
  • Thanks - I'm not much of a Java-the-language guru, took one or two semesters in university. Most of my enterprise deployment experience with java has been on Unix/Linux as Java services, or living under Tomcat or Spring.
    – mfinni
    Dec 2 '13 at 1:26
3
+50

This is one of those typical nasty errors we are faced with as sysadmins. The processes are up and running while the function/application is dead.

You can take two different approaches:

  1. Watch the log-file and react on typical error situations
  2. On the server monitor the service-functionality and react on a failure

In both situations you need to avoid false positives.

A proper reaction would be a service restart - which you have to trigger - which hopefully works in your situation.

1
  • OK, in the absence of better suggestions, you got it.
    – mfinni
    Dec 3 '13 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.