Re: JNI pthreads problem
Hi, I'm in trouble with thie JNI pthreads problem. Can someone help me on my JNI pthreads problem? Or perhaps can you point me to some other (more appropriate for this topic) mailing-list? Or some other source of support? Thanks > >Hi, > >I have a problem. > >I'm building a module for apache. apache doesn't like modules linked > >with libpthread.so. > > > >To use JNI in my application (Invocation API) I link it with libjvm.so > >and libhpi.so. > >With ldd I see that these libraries link with pthreads!!! > > > >This is a problem with apache. > > > >Someone has idea how to resolve this problem? > > > >Thanks > > > >Valerio Ferrucci > > > >P.S. > >I see tha there is a libhpi.so in a green_threads folder that doesn't > >link with pthread, but: can I use it? > >And for libjvm.so? > > > > > >-- > >To UNSUBSCRIBE, email to [EMAIL PROTECTED] > >with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > > == Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://tabasoft.ancitel.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JNI pthreads problem
libhpi.so is the threading package. The one in native_threads is the LinuxThreads version. The one in green_threads (amazingly enough) is the Green (Sun's all-user-space package) threads version. Why does Apache "not like" modules using libpthreads.so? It probably (very probably) uses it itself. It's a very strange model in which Apache sends a request to your module and you start up a VM to handle it. You probably should start your VM as a seperate process and use a socket to communicate. -John John Rousseau [EMAIL PROTECTED] SilverStream Software Phone: +1 978 262 3564 2 Federal StreetFax: +1 978 262 3499 Billerica, MA 01821 http://www.silverstream.com On Thursday Dec 14, 2000, Valerio Ferrucci wrote: > Hi, > I'm in trouble with thie JNI pthreads problem. > > Can someone help me on my JNI pthreads problem? > Or perhaps can you point me to some other (more appropriate for this topic) > mailing-list? > Or some other source of support? > > Thanks > > > >Hi, > > >I have a problem. > > >I'm building a module for apache. apache doesn't like modules linked > > >with libpthread.so. > > > > > >To use JNI in my application (Invocation API) I link it with libjvm.so > > >and libhpi.so. > > >With ldd I see that these libraries link with pthreads!!! > > > > > >This is a problem with apache. > > > > > >Someone has idea how to resolve this problem? > > > > > >Thanks > > > > > >Valerio Ferrucci > > > > > >P.S. > > >I see tha there is a libhpi.so in a green_threads folder that doesn't > > >link with pthread, but: can I use it? > > >And for libjvm.so? > > > > > > > > >-- > > >To UNSUBSCRIBE, email to [EMAIL PROTECTED] > > >with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > > > > > == > Valerio FerrucciTabasoft Sas > [EMAIL PROTECTED] http://tabasoft.ancitel.it > [EMAIL PROTECTED] > > > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JNI pthreads problem
"Rousseau, John" wrote: > libhpi.so is the threading package. The one in native_threads is the > LinuxThreads version. The one in green_threads (amazingly enough) is > the Green (Sun's all-user-space package) threads version. Which one have I to use? native or green? Where are the API of these two documented? > Why does Apache "not like" modules using libpthreads.so? It probably > (very probably) uses it itself. I don't know why. If I link my module with pthreads, then Apache fails at startup time! > It's a very strange model in which Apache sends a request to your > module and you start up a VM to handle it. You probably should start > your VM as a seperate process and use a socket to communicate. > Do you think this is the only solution? Thanks > > -John > > > John Rousseau [EMAIL PROTECTED] > SilverStream Software Phone: +1 978 262 3564 > 2 Federal StreetFax: +1 978 262 3499 > Billerica, MA 01821 http://www.silverstream.com > > > On Thursday Dec 14, 2000, Valerio Ferrucci wrote: > > > Hi, > > I'm in trouble with thie JNI pthreads problem. > > > > Can someone help me on my JNI pthreads problem? > > Or perhaps can you point me to some other (more appropriate for this topic) > > mailing-list? > > Or some other source of support? > > > > Thanks > > > > > >Hi, > > > >I have a problem. > > > >I'm building a module for apache. apache doesn't like modules linked > > > >with libpthread.so. > > > > > > > >To use JNI in my application (Invocation API) I link it with libjvm.so > > > >and libhpi.so. > > > >With ldd I see that these libraries link with pthreads!!! > > > > > > > >This is a problem with apache. > > > > > > > >Someone has idea how to resolve this problem? > > > > > > > >Thanks > > > > > > > >Valerio Ferrucci > > > > > > > >P.S. > > > >I see tha there is a libhpi.so in a green_threads folder that doesn't > > > >link with pthread, but: can I use it? > > > >And for libjvm.so? > > > > > > > > > > > >-- > > > >To UNSUBSCRIBE, email to [EMAIL PROTECTED] > > > >with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] > > > > > > > > == > > Valerio FerrucciTabasoft Sas > > [EMAIL PROTECTED] http://tabasoft.ancitel.it > > [EMAIL PROTECTED] > > > > > > > > -- > > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- == Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://tabasoft.ancitel.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JNI pthreads problem
On Thursday Dec 14, 2000, Valerio Ferrucci wrote: > "Rousseau, John" wrote: > > > libhpi.so is the threading package. The one in native_threads is the > > LinuxThreads version. The one in green_threads (amazingly enough) is > > the Green (Sun's all-user-space package) threads version. > > Which one have I to use? native or green? > Where are the API of these two documented? It depends on which threading model you want. You should probably use whatever Apache is using. > > Why does Apache "not like" modules using libpthreads.so? It probably > > (very probably) uses it itself. > > I don't know why. If I link my module with pthreads, then Apache fails at > startup time! As far as I know, there can be only one threading package running in a process at a time. > > It's a very strange model in which Apache sends a request to your > > module and you start up a VM to handle it. You probably should start > > your VM as a seperate process and use a socket to communicate. > > > > Do you think this is the only solution? No. What you need to do is have the threading model that Apache is using schedule in your threads to it's run queue. I don't think this is possible with the Java VM (it wants to have control). -John John Rousseau [EMAIL PROTECTED] SilverStream Software Phone: +1 978 262 3564 2 Federal StreetFax: +1 978 262 3499 Billerica, MA 01821 http://www.silverstream.com -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JNI pthreads problem
Hi John, ok, I have an application that uses invocation API. But there I have another problem. When I launch it I see the logs message [Dynamic-linking... [Dynamic-linking... ... [Dynamic-linking native method java/lang/Double.longBitsToDouble...JNI] SIGSEGV11* segmentation violation si_signo [0]: no signal If you want I can send you more. This happens if I link with green or native Thanks for help > > Do you think this is the only solution? > > No. What you need to do is have the threading model that Apache is > using schedule in your threads to it's run queue. I don't think this > is possible with the Java VM (it wants to have control). > > -John > > > John Rousseau [EMAIL PROTECTED] > SilverStream Software Phone: +1 978 262 3564 > 2 Federal StreetFax: +1 978 262 3499 > Billerica, MA 01821 http://www.silverstream.com > -- == Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://tabasoft.ancitel.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Socket Exception out of Nowhere !!
I don't know if my own experience has a significantly different cause, but I get a SocketException with a "Resource temporarily unavailable" message if I'm waiting for input and the thread is interrupted. Merely catching the exception and retrying the read operation is all that is required; what the interruption allows you to do is respond to the interrupt if necessary. Perhaps that helps? -- - |._.|_ Udo K. Schuermann"The future's not what it used to be." |( )| ) [EMAIL PROTECTED] -- G'Kar, Babylon 5, "The Long Dark" |_:_|/ Senior Software Engineer, Blackboard Inc. Sum ergo cogito! Blackboard - Bringing Education Online -> http://www.Blackboard.com > Date: Tue, 12 Dec 2000 11:51:11 +0530 > From: Santosh Dawara <[EMAIL PROTECTED]> > Subject: Socket Exception out of Nowhere !! > > Hi All, > ... > I noticed that, if one session is active, and > If I open another session with the Server, a SocketException > is thrown in the existing session. > > Reproduced below is the relevant stack trace: > java.net.SocketException: Interrupted system call > at java.net.SocketInputStream.socketRead(Native Method) > at java.net.SocketInputStream.read(SocketInputStream.java:90) > at java.net.SocketInputStream.read(SocketInputStream.java:71) > at java.io.InputStreamReader.fill(InputStreamReader.java:163) > at java.io.InputStreamReader.read(InputStreamReader.java:239) > at java.io.BufferedReader.fill(BufferedReader.java:137) > at java.io.BufferedReader.read(BufferedReader.java:154) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JNI pthreads problem
At 9:52 12 Dec 2000 -0500, Rousseau, John wrote: > It's a very strange model in which Apache sends a request to your > module and you start up a VM to handle it. You probably should start > your VM as a seperate process and use a socket to communicate. I don't think this is so strange. While JServ/Tomcat works this way, it really would be quicker to do this communication via JNI calls than pipe it across another socket. There was an (attempt at) an effort to do this with Apache open-source, I'm not sure where that's going... > Why does Apache "not like" modules using libpthreads.so? It probably > (very probably) uses it itself. It seems to me that if it used it itself then there *wouldn't* be a problem. For instance, you can't link a JNI library that uses pthreads against a Java VM running green threads. But, if our JNI library uses pthreads & the Java VM uses pthreads, everyone is happy. > libhpi.so is the threading package. The one in native_threads is the > LinuxThreads version. The one in green_threads (amazingly enough) is > the Green (Sun's all-user-space package) threads version. I agree that using green-threads (export THREADS_FLAG=green; might work) should resolve this problem and make the JDK run with green-threads. But maybe this uses other signals that will conflict with apache in some way? I'm guessing, but this wouldn't surprise me very much at all. After all that, I'm still in agreement with you about the outcome - do it in a seperate VM, not using the invocation API. Yes, it's quicker, yes it will work better on Windows (where all threads are equal ;), and yes it's more work. But I'd expect some unstability to come from trying to do this in-process on Linux. Paul -- Paul Mclachlan ([EMAIL PROTECTED]) Software Engineer, Java Tools. NuMega Lab, Compuware corp. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Socket Exception out of Nowhere !!
Phew, I thought someone unsubscribed me from the list because of the question, I had not received any reply for four days straight. To be honest I can't retry the read operation because I would go into a Hard loop if a real SocketException occured due to some other reason. So I will use a count to keep track of the number of times it occured. Anyhow, the reason why this happens is still not clear. Someone here must have something to say about this. I have never seen this happen on Windows. Thanks, Santosh Dawara. http://cravelinux.cjb.net Udo K Schuermann wrote: > > I don't know if my own experience has a significantly different cause, > but I get a SocketException with a "Resource temporarily unavailable" > message if I'm waiting for input and the thread is interrupted. Merely > catching the exception and retrying the read operation is all that is > required; what the interruption allows you to do is respond to the > interrupt if necessary. > > Perhaps that helps? > > -- - > |._.|_ Udo K. Schuermann"The future's not what it used to be." > |( )| ) [EMAIL PROTECTED] -- G'Kar, Babylon 5, "The Long Dark" > |_:_|/ Senior Software Engineer, Blackboard Inc. Sum ergo cogito! > Blackboard - Bringing Education Online -> http://www.Blackboard.com > > > Date: Tue, 12 Dec 2000 11:51:11 +0530 > > From: Santosh Dawara <[EMAIL PROTECTED]> > > Subject: Socket Exception out of Nowhere !! > > > > Hi All, > > ... > > I noticed that, if one session is active, and > > If I open another session with the Server, a SocketException > > is thrown in the existing session. > > > > Reproduced below is the relevant stack trace: > > java.net.SocketException: Interrupted system call > > at java.net.SocketInputStream.socketRead(Native Method) > > at java.net.SocketInputStream.read(SocketInputStream.java:90) > > at java.net.SocketInputStream.read(SocketInputStream.java:71) > > at java.io.InputStreamReader.fill(InputStreamReader.java:163) > > at java.io.InputStreamReader.read(InputStreamReader.java:239) > > at java.io.BufferedReader.fill(BufferedReader.java:137) > > at java.io.BufferedReader.read(BufferedReader.java:154) > > -- > To UNSUBSCRIBE, email to [EMAIL PROTECTED] > with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: JNI pthreads problem
Hi, thanks for your help. Generally I'm thinking that my code doesn't feel so comfortable in apache module. I already had a similar headache-problem with libmysqlclient.so (that linked against pthreads and made crash apache) and I think I will have more and more problems in the future if i don't separate my code from apache. I'm thinking now to split my code into two pieces: an apache module and a separate application (containing almost all of my code, including Invocation API calls). The ap module (the client) simply packs the request and "send" it to the application (the server). The application will processes data and send back the response to the ap module that returns it to apache. In this way (almost) all of my code lives in a separate process space and I'm free from apache constrains. What do you think of this solution? Which is, for you, the best way to communicate between the module and application? Do you think the overhead (for interprocess communication) will be inacceptable (I need speed!)? Paul Mclachlan wrote: > After all that, I'm still in agreement with you about the outcome - do it in a > seperate VM, not using the invocation API. How can I use JNI calls from my application without the Invocation API (my starting point is C (not java))?. Thanks == Valerio FerrucciTabasoft Sas [EMAIL PROTECTED] http://tabasoft.ancitel.it [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]