Skip to content

Commit 8bb6e5f

Browse files
thunderstumpgesprateekm
authored andcommitted
SAMZA-2231: Exception thrown during yarn staging directory cleanup masks original exception
Failures cleaning up the staging directory on another exception were masking the original exception making troubleshooting difficult. Add some logging and an extra try/catch around the cleanup. Author: thunderstumpges <[email protected]> Reviewers: Daniel Nishimura <[email protected]> Closes apache#1059 from thunderstumpges/try-catch-on-staging-cleanup
1 parent bd647bb commit 8bb6e5f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

samza-yarn/src/main/scala/org/apache/samza/job/yarn/YarnJob.scala

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,16 @@ class YarnJob(config: Config, hadoopConfig: Configuration) extends StreamJob {
7171
)
7272
} catch {
7373
case e: Throwable =>
74-
client.cleanupStagingDir
75-
throw e
74+
logger.error("Exception submitting yarn job.", e )
75+
try {
76+
// try to clean up. this may throw an exception depending on how far into launching the job we got.
77+
// we don't want to mask the original problem by throwing this.
78+
client.cleanupStagingDir
79+
} catch {
80+
case ce: Throwable => logger.warn("Exception cleaning Staging Directory after failed launch attempt.", ce)
81+
} finally {
82+
throw e
83+
}
7684
}
7785

7886
this

0 commit comments

Comments
 (0)