[SOLVED] Re: Java/threading problems

Igor Clark <igor-+wACT2lsjD7SUeElwK9/[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel,gmane.spam.detected
Message-ID <[email protected]>
Hi - just FYI I went back to basics and fixed up my code using the dev- 
kit Java library. It wasn't synchronized properly, and some of the  
stream buffering was getting confused - my fault, so sorry for the  
noise on that point.

However I still haven't managed to get either of the 'jfast'  
implementations to work with or without modifications; I imagine there  
may be similar problems but I haven't been through the code in any  
detail, so. It would be really interesting to know whether anyone uses  
or has used either of these libraries with any degree of success.

Best wishes
Igor

On 19 Dec 2007, at 16:37, Igor Clark wrote:

> Hi there,
>
> I'm doing some proof-of-concept work into writing a threaded FCGI  
> server in Java, testing against nginx/0.5.34 (solid in production  
> with PHP-FCGI), and I'm getting nowhere fast. Here's what I've been  
> doing:
>
> 1) Tried to use the dev-kit Java code. Basically rewrote the  
> FCGIInterface FCGIaccept() and FCGIAccept() methods as a service in  
> an existing threaded server framework. I get all sorts of connection  
> and protocol errors; presumably this is because the code, or one of  
> its dependencies, is not thread-safe? I wondered whether it might  
> just be FCGIInterface, but perhaps it's the whole library? I tested  
> it against Apache/mod_fastcgi too, with the same problems.
>
> 2) I found JFast at http://sourceforge.net/projects/jfast which  
> seems intended in part to run as a multithreaded FCGI server, so I  
> thought I could rip out some of the (presumably thread-safe)  
> transport and stream code from there. It builds and runs (although  
> built against an old JSDK so debugging is a pain as I can't modify  
> some of the source classes), but it fails, saying that  
> "FCGITransConn(0).errorOut: msg: unsupported version: 0 (whole  
> header = #00014010#); expecting version 1" while nginx says   
> "upstream sent unexpected FastCGI record: 3 while reading response  
> header". 'K.
>
> 3) I also found http://www.stewartspeak.com/projects/jfast/ - this  
> builds and runs, but just hangs when it receives a connection; when  
> you kill the app, the output seems to get flushed and nginx forwards  
> it to the webserver, but that's not much use if the app's dead for  
> other requests.
>
> I've read the spec and I think I have a sufficient understanding of  
> the protocol to know that what I'm doing "should" work ;-). I've  
> been trying to trace through with a debugger/nc/tcpdump to see  
> what's happening, but the only thing I've been able to guess at so  
> far is that I'm encountering the sort o threading/streaming/timing  
> issues that are a nightmare to track down. Before I go any further,  
> could anyone point me vaguely in the right direction? Am I missing  
> something fundamental? Is there a modern, thread-safe Java library  
> implementation that I don't know about? Or would I have to start  
> from scratch?
>
> Many thanks for any tips.
>
> Bests,
> Igor Clark
>
> --
> Igor Clark // POKE // 10 Redchurch Street // E2 7DD // +44 (0)20  
> 7749 5355 // www.pokelondon.com
>
> --
> We like good things. So we made some for Orange.
> http://www.goodthingsshouldneverend.co.uk/
>
> --
> Get on Board with WWF for a stronger Climate Change Bill
> http://getonboard.wwf.org.uk/
>
>
>

--
Igor Clark // POKE // 10 Redchurch Street // E2 7DD // +44 (0)20 7749  
5355 // www.pokelondon.com

--
We like good things. So we made some for Orange.
http://www.goodthingsshouldneverend.co.uk/

--
Get on Board with WWF for a stronger Climate Change Bill
http://getonboard.wwf.org.uk/



___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.