[ 
https://issues.apache.org/jira/browse/BEAM-9490?focusedWorklogId=403096&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-403096
 ]

ASF GitHub Bot logged work on BEAM-9490:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Mar/20 19:04
            Start Date: 13/Mar/20 19:04
    Worklog Time Spent: 10m 
      Work Description: tweise commented on pull request #11108: [BEAM-9490] 
Guard referencing for environment expiration via a lock
URL: https://github.com/apache/beam/pull/11108#discussion_r392417670
 
 

 ##########
 File path: 
runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/control/DefaultJobBundleFactory.java
 ##########
 @@ -406,8 +438,16 @@ public RemoteBundle getBundle(
         availableCachesSemaphore.acquire();
         // The blocking queue of caches for serving multiple bundles 
concurrently.
         currentCache = availableCaches.take();
-        client = currentCache.getUnchecked(executableStage.getEnvironment());
-        client.ref();
+        // Lock because the environment expiration can remove the ref for the 
client
+        // which would close the underlying environment before we can ref it.
+        Lock refLock = environmentCacheLocks.get(environmentIndex);
 
 Review comment:
   This isn't picking the correct lock, addressed in 
https://github.com/apache/beam/pull/11108/commits/5ebae2cd735bc8b93af6d8ec6132c3f06e256fae
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 403096)
    Time Spent: 1h 10m  (was: 1h)

> Environment may be cleaned up prematurely when using environment expiration
> ---------------------------------------------------------------------------
>
>                 Key: BEAM-9490
>                 URL: https://issues.apache.org/jira/browse/BEAM-9490
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Maximilian Michels
>            Assignee: Maximilian Michels
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> When environment expiration is configured, environments are removed from a 
> cache map after some amount of time. This cache map may be accessed by 
> multiple ExecutableStage transforms in parallel. During environment 
> expiration there is a small time window which allows for an environment to 
> still being used while another transform removes, dereferences, and closes 
> the environment. This is not expected behavior.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to