On Mon, Aug 10, 2020 at 3:44 PM Alexandr Miloslavskiy
<alexandr.miloslavskiy_at_syntevo.com> 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.
> ]]]
Ping...
Just want to make sure this patch isn't lost. It looks reasonable to
me but I'm not an expert in this area. Could someone review it please?
Also there's one other patch I'll ping in a moment...
Thanks,
Nathan
Received on 2020-08-16 17:02:35 CEST