Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Dec 2001 10:17:37 +0100
From:      Cedric Berger <cedric@wireless-networks.com>
To:        Joe Kelsey <joe@zircon.seattle.wa.us>
Cc:        freebsd-java@freebsd.org
Subject:   Re: JavaVM5 *major* foobar
Message-ID:  <3C0DE631.3000000@wireless-networks.com>
References:  <15373.22183.229468.123327@zircon.zircon.seattle.wa.us>

next in thread | previous in thread | raw e-mail | index | archive | help
Just out of curiosity:
  are theses kind of obvious patches sent to Sun, so JDK 1.4, 1.5, 1.6 
won't need
  to be patched again?

Cedric


Joe Kelsey wrote:

>Something has been bothering me for quite some time.  Every once in a
>while, during my testing of the plugin, I start getting unexplained
>errors during the thread attach process.  I could never figure out why,
>and sooner or later, the problem disappeared on its own.
>
>Well, I finally got tired of the problem and started exploring the root
>cause.  It seems that JavaVM5 creates a UNIX-domain socket for the
>plugin to connect to.  It names this socket /tmp/jpsock.131.pid, where
>pid is the Mozilla pid.  It then passes this to the child after
>performing a htons() on it.  The child takes the 4-byte value and
>performs another htons() and uses it to try to connect to the socket.
>
>I'm sure everyone can see the excruciating horribleness of this thing
>now.  This apparantly works on machines with traditional, "short" pids,
>but on FreeBSD it breaks horribly whenever the pids rise above 65384.
>
>Anyway, the fix is obvious, and needs to be implemented in both
>JavaVM5.cpp and server.c.  Since Greg is collecting a new patch, this is
>important enough to include.  I will try to see if I find any other
>similar mistakes that could be causing my current woes.
>
>Here are the diffs for the files, just for the changes to fix the pid
>problem.
>
>/Joe
>
>--- JavaVM5.cpp~	Thu Nov 22 10:18:59 2001
>+++ JavaVM5.cpp	Tue Dec  4 14:53:00 2001
>@@ -510,7 +510,7 @@
>     bzero(net_address.local.path,sizeof(net_address.local.path));
>     sprintf(net_address.local.path,"%s.%s.%d",JAVA_PLUGIN_SOCKFILE,PLUGIN_NODOTVERSION,spid);
>     unlink(net_address.local.path);
>-    try_port = htons(spid);
>+    try_port = htonl(spid);
>     if(PR_Bind(server_socket, &net_address) != PR_SUCCESS) {
>         TRACE_INT("Binding of server socket failed", try_port);
>     }
>
>--- server.c~	Thu Nov 22 10:18:59 2001
>+++ server.c	Tue Dec  4 14:52:58 2001
>@@ -2703,7 +2703,7 @@
>       inet_addr(inet_ntoa(hostPtr->h_addr_list[0]));
> */
>     client.sin_addr.s_addr = *(int *)(hostPtr->h_addr_list[0]);
>-    client.sin_port = htons(port);
>+    client.sin_port = ntohs(port);
> 
>     native_trace("Using port: %d\n", port);
> 
>@@ -2713,7 +2713,7 @@
> #else
>     bzero(&client,sizeof(client));
>     client.sun_family = AF_UNIX;
>-    sprintf(client.sun_path,"%s.%s.%d",JAVA_PLUGIN_SOCKFILE,PLUGIN_NODOTVERSION,htons(port));
>+    sprintf(client.sun_path,"%s.%s.%d",JAVA_PLUGIN_SOCKFILE,PLUGIN_NODOTVERSION,ntohl(port));
> 
>     native_trace("Using file: %s\n", client.sun_path);
> 
>
>To Unsubscribe: send mail to majordomo@FreeBSD.org
>with "unsubscribe freebsd-java" in the body of the message
>




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C0DE631.3000000>