You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Hai Zhang (Jira)" <ji...@apache.org> on 2022/03/13 09:23:00 UTC

[jira] [Commented] (FTPSERVER-478) java.nio.charset.CoderMalfunctionError: java.nio.BufferUnderflowException

    [ https://issues.apache.org/jira/browse/FTPSERVER-478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17505414#comment-17505414 ] 

Hai Zhang commented on FTPSERVER-478:
-------------------------------------

I've been hit by this when I send FTP commands rapidly to the server, and I think I've found the culprit:

FtpResponseEncoder uses one static CharsetEncoder instance (FtpResponseEncoder.ENCODER) and it's used by multiple threads in an OrderedThreadPoolExecutor. However, CharsetEncoder isn't thread-safe:

> Instances of this class are not safe for use by multiple concurrent threads.

https://docs.oracle.com/javase/8/docs/api/java/nio/charset/CharsetEncoder.html

So please make FtpResponseEncoder.ENCODER a ThreadLocal<CharsetEncoder> instead of a plain CharsetEncoder to fix this.

> java.nio.charset.CoderMalfunctionError: java.nio.BufferUnderflowException
> -------------------------------------------------------------------------
>
>                 Key: FTPSERVER-478
>                 URL: https://issues.apache.org/jira/browse/FTPSERVER-478
>             Project: FtpServer
>          Issue Type: Bug
>          Components: Core, Server
>    Affects Versions: 1.1.0
>         Environment: Media Box with Android 4.4.2
>            Reporter: Jerry Wu
>            Priority: Major
>             Fix For: 1.0.6
>
>
> java.nio.BufferUnderflowException is never happened in 1.0.6, it happened in 1.1.0 frequently, I wonder whether this exception is from files name with Chinese character



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org