[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Fix JavaHL crash in RequestChannel.nativeRead

From: Thomas Singer <thomas.singer_at_syntevo.com>
Date: Wed, 9 Sep 2020 13:38:50 +0200

Has this patch been merged yet? If not, what input is needed to get it


On 2020-08-10 21:30, Alexandr Miloslavskiy wrote:
> Please find test snippet and patch attached.
> [[[
> Fix JavaHL crash in RequestChannel.nativeRead
> The problem here is that when 'RemoteSession' is destroyed, it also
> does 'apr_pool_destroy()' which frees memory behind 'apr_file_t', which
> is represented by 'TunnelChannel.nativeChannel' in Java.
> 'TunnelChannel' runs on a different thread and is unaware that
> 'apr_file_t' pointer is now invalid.
> Fix this by informing 'TunnelChannel' before 'apr_file_t' is freed.
> One other problem is that when 'TunnelAgent.openTunnel()' throws an
> exception, 'OperationContext::closeTunnel()' was not called at all.
> [in subversion/bindings/javahl]
> * native/OperationContext.cpp
>   (close_TunnelChannel): New function to inform Java side.
>   (openTunnel): Keep references to Java tunnel objects.
>   (openTunnel): In case of exception, clean up properly.
>   (closeTunnel): Inform Java side when tunnel is closed.
> * src/org/apache/subversion/javahl/util/RequestChannel.java
>   Add 'synchronized' to avoid error described in 'syncClose()'
> * src/org/apache/subversion/javahl/util/ResponseChannel.java
>   Add 'synchronized' to avoid error described in 'syncClose()'
> * src/org/apache/subversion/javahl/util/Tunnel.java
>   A new function to clean up. I decided not to change old '.close()'
>   because the new function can lead to a deadlock if used incorrectly.
> ]]]
Received on 2020-09-09 13:39:08 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.