This is an automated email from the ASF dual-hosted git repository.

bharathkk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/samza.git


The following commit(s) were added to refs/heads/master by this push:
     new c43f42335 SAMZA-2774: Resolve classpath symlinks (#1653)
c43f42335 is described below

commit c43f423356e8cb0f487b5211be00896c08a5caca
Author: Jon Bringhurst <j...@bringhurst.org>
AuthorDate: Wed Aug 30 18:01:15 2023 -0700

    SAMZA-2774: Resolve classpath symlinks (#1653)
    
    Manifest generation (application-level) is pointing to container-level 
symlinks instead of application-level files.
    
    This will cause issues when multiple containers for an application land on 
a single host and the container the manifest is pointing to gets cleaned up.
    
    [yyy@zzz filecache]$ cat 
/data/appcache/application_1668550466222_0989/filecache/10/xxx-0.0.672.tgz/classpath_workspace/manifest.txt|tail
 -n 2
     
/data/appcache/application_1668550466222_0989/container_e114_1668550466222_0989_01_000003/__package/lib/zstd-jni-1.5.2-3.jar
    
    [yyy@zzz filecache]$
    This patch is to resolve those symlinks to their application level paths.
---
 samza-shell/src/main/bash/run-class.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/samza-shell/src/main/bash/run-class.sh 
b/samza-shell/src/main/bash/run-class.sh
index e95ec6d89..e2cb04ea8 100755
--- a/samza-shell/src/main/bash/run-class.sh
+++ b/samza-shell/src/main/bash/run-class.sh
@@ -57,7 +57,11 @@ CLASSPATH=""
 # all the jars need to be appended on newlines to ensure line argument length 
of 72 bytes is not violated
 for file in $BASE_LIB_DIR/*.[jw]ar;
 do
-  CLASSPATH=$CLASSPATH" $file \n"
+  # Symlinks need to be resolved here, otherwise, the jars listed in the
+  # manifest below will point at the first container launched instead of
+  # the jars at the application level.
+  resolved_file=$( cd $(dirname $(readlink `[[ $OSTYPE == linux* ]] && echo 
"-f"` "$file")) ; pwd -P)
+  CLASSPATH=$CLASSPATH" $resolved_file \n"
 done
 echo generated from BASE_LIB_DIR CLASSPATH=$CLASSPATH
 

Reply via email to