From: Ito Kazumitsu <[EMAIL PROTECTED]> Subject: [kaffe] Apache Jakarta Commons Net does not work on Linux Date: Tue, 02 Aug 2005 00:10:49 +0900 (JST)
> I have found that apache Jakarta Commons Net does not work > with current Kaffe on Linux. I slightly changed the test program to find the following. (1) Telnet client including FTP client of Apache Commons Net performs its socket input operation in a different thread called reader thread. (2) When run on Kaffe on Linux, there seems to occur a deadlock between the reader thread and the current thread. The writing operation of the current thread cannot be finished until some state of the reader thread changes. But the reading thread is waiting for a response from the server, which will never come until the writing operation of the current thread is finished. (3) Such deadlock does not occur when run on Sun's JDK or on Kaffe on FreeBSD. (4) By setting some socket timeout value, the deadlock of (2) can be releasd. But such timeout means the death of the reading thread and this cannot be a solusion of the problem. And on Linux 2.6.7-co-0.6.2, setting a timeout causes another error like $ java TestCommonsNet somehost foo bar 5000 true 220 kaffe-bin: pthread_mutex_lock.c:78: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed. Aborted (5) Telnet client including FTP client of Apache Commons Net has an option of disabling the use of reader thread. This helps to avoid the deadlock of (2). Application system users can be satisfied with (5), but the problem (2) seen only on Kaffe on Linux indicates some bugs in Kaffe. My test program follows. import org.apache.commons.net.ftp.*; public class TestCommonsNet { public static void main(String[] args) throws Exception { String hostName = args[0]; int port = 21; String userName = args[1]; String password = args[2]; int timeout = Integer.parseInt(args[3]); boolean readerThread = (args[4].equals("true")); FTPClient _ftpClient = new FTPClient(); _ftpClient.setDefaultTimeout(timeout); _ftpClient.setReaderThread(readerThread); _ftpClient.connect(hostName, port); System.err.println(_ftpClient.getReplyCode()); _ftpClient.login(userName, password); System.err.flush(); System.err.println(_ftpClient.getReplyCode()); _ftpClient.logout(); System.err.println(_ftpClient.getReplyCode()); } } _______________________________________________ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe