[
https://issues.apache.org/jira/browse/VFS-817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17507690#comment-17507690
]
Mykhailo commented on VFS-817:
------------------------------
I think i have a fix, not sure if its optimal or not, but i've get rid of
deadlocks.
Main idea is to analyze all synchronized methods on SftpFileObject and if
FileSystem is used inside of method remove synchronized from method and put
logic inside synchronized block that synchronized on FileSystem and than on
FileObject, eg
original
private synchronized void flushStat() throws IOException, SftpException {
final ChannelSftp channel = getAbstractFileSystem().getChannel();
try {
channel.setStat(relPath, attrs);
} finally {
getAbstractFileSystem().putChannel(channel);
}
}
replaced by
private void flushStat() throws IOException, SftpException {
synchronized (getAbstractFileSystem()) {
synchronized (this) {
final ChannelSftp channel =
getAbstractFileSystem().getChannel();
try {
channel.setStat(relPath, attrs);
} finally {
getAbstractFileSystem().putChannel(channel);
}
}
}
}
> DeadLock on SftpFileObject
> --------------------------
>
> Key: VFS-817
> URL: https://issues.apache.org/jira/browse/VFS-817
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.9.0
> Reporter: Mykhailo
> Priority: Major
> Attachments: cores.zip
>
>
> Deadlock happens on SftpFileObject.
> {color:#000000}No matter using shared between threads
> StandardFileSystemManager or separate manager for each thread (different
> stack trace in core, but still deadlock){color}
> Not reproduced on 2.8.0.
> Core files in attach (one for separate
> {color:#000000}StandardFileSystemManager {color}, one for shared between
> threads)
>
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)