shanyu commented on a change in pull request #187:  LIVY-617: Livy session leak 
on Yarn when creating session duplicated names
URL: https://github.com/apache/incubator-livy/pull/187#discussion_r314205285
 
 

 ##########
 File path: server/src/main/scala/org/apache/livy/sessions/SessionManager.scala
 ##########
 @@ -96,14 +96,18 @@ class SessionManager[S <: Session, R <: RecoveryMetadata : 
ClassTag](
     synchronized {
       session.name.foreach { sessionName =>
         if (sessionsByName.contains(sessionName)) {
-          throw new IllegalArgumentException(s"Duplicate session name: 
${session.name}")
+          val errMsg = s"Duplicate session name: ${session.name} for session 
${session.id}"
+          error(errMsg)
+          session.stop()
 
 Review comment:
   Yeah it a little odd.
   
   createSession() calls InteractiveSession.create(), which calls 
LivyClientBuilder().build(), which creates a LivyClient, then create an 
InteractiveSession with this client. At this time the separate process is 
running which creates a Yarn application. This is before session.start() is 
called.
   
   But to clean this Yarn application, we need to call session.stop().
   
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to