You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Niklas Gustavsson (JIRA)" <ji...@apache.org> on 2009/04/14 12:37:14 UTC
[jira] Updated: (FTPSERVER-290) DefaultFtpStatistics throws
NullPointerException when account login repeatdly
[ https://issues.apache.org/jira/browse/FTPSERVER-290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Niklas Gustavsson updated FTPSERVER-290:
----------------------------------------
Attachment: Test.java
> DefaultFtpStatistics throws NullPointerException when account login repeatdly
> -----------------------------------------------------------------------------
>
> Key: FTPSERVER-290
> URL: https://issues.apache.org/jira/browse/FTPSERVER-290
> Project: FtpServer
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.0.0
> Environment: Linux RedHat EL 2.6.9-42.ELsmp
> Reporter: Ulysses Lee
> Attachments: Test.java
>
>
> When I write a Testcase to make a proformance test for Apache ftp server,
> and I only use ONE ftp account in many threads to upload different files, then after about 10 users loged in,
> it throws exception:
>
> [2009-04-14 09:30:52,973] [WARN ] DefaultFtpHandler [t001@bbapp.net] [125.88.130.8] - RequestHandler.service()
> java.lang.NullPointerException
> at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
> at org.apache.ftpserver.impl.DefaultFtpStatistics$UserLogins.loginsFromInetAddress(DefaultFtpStatistics.java:90)
> at org.apache.ftpserver.impl.DefaultFtpStatistics.getCurrentUserLoginNumber(DefaultFtpStatistics.java:259)
> at org.apache.ftpserver.command.impl.USER.execute(USER.java:152)
> at org.apache.ftpserver.impl.DefaultFtpHandler.messageReceived(DefaultFtpHandler.java:169)
> at org.apache.ftpserver.listener.nio.FtpHandlerAdapter.messageReceived(FtpHandlerAdapter.java:65)
> most likey a thread lock problem?
> My test case used Apache NET lib with FTP, it like:
> import java.io.BufferedInputStream;
> import java.io.File;
> import java.io.FileInputStream;
> import java.io.IOException;
> import java.io.InputStream;
> import org.apache.commons.net.ftp.FTP;
> import org.apache.commons.net.ftp.FTPClient;
> import org.apache.commons.net.ftp.FTPReply;
> public static void main(String[] args) {
> starttime = System.currentTimeMillis();
> final File f = new File("F:/WorkSpace/Hermes/Hermes.jar");
> for (int i = 0; i < 300; i++) {
> final int j = i;
> new Thread() {
> public void run() {
> testUpload("user", "pass", f);
> }
> }.start();
> }
> }
> public static void testUpload(String username, String password, File localFile) {
> FTPClient ftp = new FTPClient();
> try {
> ftp.connect(server, port);
> System.out.println("Connected to " + server + ".");
> ftp.login(username, password);
> int reply = ftp.getReplyCode();
> if (!FTPReply.isPositiveCompletion(reply)) {
> ftp.disconnect();
> System.err.println("FTP server refused connection.");
> System.exit(1);
> }
> ftp.setFileType(FTP.BINARY_FILE_TYPE);
> ftp.enterLocalActiveMode();
> ftp.setFileTransferMode(FTP.STREAM_TRANSFER_MODE);
> InputStream input = new FileInputStream(localFile);
> BufferedInputStream bin = new BufferedInputStream(input);
> boolean flag = ftp.storeFile(localFile.getName(), bin);
> if (flag) {
> System.out.println("success! cost:<" + (System.currentTimeMillis() - starttime)
> + " ms>");
> } else {
> System.out.println("fail! cost:<" + (System.currentTimeMillis() - starttime)
> + " ms>");
> }
> ftp.logout();
> } catch (IOException e) {
> e.printStackTrace();
> } finally {
> if (ftp.isConnected()) {
> try {
> ftp.disconnect();
> } catch (IOException ioe) {
> }
> }
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.