Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session.stop() does not stop the correct session #18

Open
billreed63 opened this issue Jan 16, 2017 · 0 comments
Open

Session.stop() does not stop the correct session #18

billreed63 opened this issue Jan 16, 2017 · 0 comments
Labels

Comments

@billreed63
Copy link
Contributor

If I have node code that creates multiple Toree session, only one of the sessions will be stopped when session.stop() is used.

The example code creates 5 sessions, then attempts stop each session, only one session is stopped.

node code:

(function (exports, require, module, __filename, __dirname) {
var eclairjs = require('eclairjs');
var spark = new eclairjs();




	//val data = sc.textFile("swift2d://wordcount.myBluemixOs/dream.txt")
//	val data = sc.textFile("swift://wordcount.myBluemixOs/dream.txt")
//	data.count()
var session = [null, null, null, null, null];
function sessionLoop(i) {
	session[i] = spark.sql.SparkSession.builder()
	  .appName("test")
	  .getOrCreate();
	var sc = session[i].sparkContext();
	var rdd = sc.parallelize([1,2,3]);
	
	//rdd.count().then(function(val) {
	//  console.log("Success:", val);
	//  stop();
	//}).catch(stop);
	
	rdd.randomSplit([0.5, 0.5], 0).then(function(split){
	  	var training_RDD = split[0];
	    var validation_RDD = split[1];
	    training_RDD.count().then(function(val) {
	      console.log("Success:", val);
	      stop(i);
	    }).catch(stop);
  });
}
// stop spark streaming when we stop the node program
process.on('SIGTERM', stop);
process.on('SIGINT', stop);

function exit() {
  process.exit(0);
}

function stop(i) {


  if (session[i]) {
	  console.log("stop session " + i);
    session[i].stop().then(
    		function(){
    			session[i] = null;
    			}, exit);
  }
}

for (var i = 0; i < 5; i++) {
	sessionLoop(i);
}

});

When the code is run I see the following messages in the console:

Starting websocket ws://127.0.0.1:8888/api/kernels/f54b51df-59d4-482e-b345-237cc79af9df
Starting websocket ws://127.0.0.1:8888/api/kernels/9c95e464-5819-4eb4-ab91-a4e4295520f9
Starting websocket ws://127.0.0.1:8888/api/kernels/8e51ac99-453f-4ddf-9c88-264b260bd971
Starting websocket ws://127.0.0.1:8888/api/kernels/265baa12-d6f6-4f79-ab97-6b1e640f7aa6
Starting websocket ws://127.0.0.1:8888/api/kernels/9ce7272e-1a1a-4f35-8f7d-cb99f5aef1eb

When session.stop() I see the following error messages:

Kernel does not exist: 8e51ac99-453f-4ddf-9c88-264b260bd971
Kernel does not exist: 8e51ac99-453f-4ddf-9c88-264b260bd971
Kernel does not exist: 8e51ac99-453f-4ddf-9c88-264b260bd971
Kernel does not exist: 8e51ac99-453f-4ddf-9c88-264b260bd971

We seem to be losing track of the sessions and only using one of the sessions.

In Toree console

17/01/16 11:52:38 [INFO] o.a.t.Main$$anon$1 - Shutting down kernel
17/01/16 11:52:38 [INFO] o.a.t.Main$$anon$1 - Shutting down interpreters
17/01/16 11:52:38 [INFO] o.a.t.Main$$anon$1 - Shutting down actor system
[I 11:52:38.964 NotebookApp] Kernel shutdown: 8e51ac99-453f-4ddf-9c88-264b260bd971
[W 11:52:38.966 NotebookApp] Kernel does not exist: 8e51ac99-453f-4ddf-9c88-264b260bd971
[W 11:52:38.967 NotebookApp] 404 DELETE /api/kernels/8e51ac99-453f-4ddf-9c88-264b260bd971?1484585538391 (127.0.0.1) 0.98ms referer=None
[W 11:52:38.968 NotebookApp] Kernel does not exist: 8e51ac99-453f-4ddf-9c88-264b260bd971
[W 11:52:38.968 NotebookApp] 404 DELETE /api/kernels/8e51ac99-453f-4ddf-9c88-264b260bd971?1484585558437 (127.0.0.1) 0.98ms referer=None
[W 11:52:38.969 NotebookApp] Kernel does not exist: 8e51ac99-453f-4ddf-9c88-264b260bd971
[W 11:52:38.969 NotebookApp] 404 DELETE /api/kernels/8e51ac99-453f-4ddf-9c88-264b260bd971?1484585558438 (127.0.0.1) 0.73ms referer=None
[W 11:52:38.970 NotebookApp] Kernel does not exist: 8e51ac99-453f-4ddf-9c88-264b260bd971
[W 11:52:38.970 NotebookApp] 404 DELETE /api/kernels/8e51ac99-453f-4ddf-9c88-264b260bd971?1484585558437 (127.0.0.1) 0.65ms referer=None

When I stop toree I see these messages:

^C[I 12:06:28.724 NotebookApp] interrupted
Serving notebooks from local directory: /Users/billreed/eclairjs_dev/incubator-toree
4 active kernels 
The Jupyter Notebook is running at: http://localhost:8888/
Shutdown this notebook server (y/[n])? ^C[C 12:06:28.868 NotebookApp] received signal 2, stopping
[I 12:06:28.869 NotebookApp] Shutting down kernels
Unauthorized system.exit detected!
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down kernel
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down interpreters
Unauthorized system.exit detected!
Unauthorized system.exit detected!
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down kernel
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down interpreters
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down kernel
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down interpreters
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down actor system
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down actor system
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down actor system
Unauthorized system.exit detected!
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down kernel
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down interpreters
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down actor system
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down interpreters
17/01/16 12:06:28 [INFO] o.a.t.Main$$anon$1 - Shutting down actor system
[I 12:06:29.591 NotebookApp] Kernel shutdown: 265baa12-d6f6-4f79-ab97-6b1e640f7aa6
[I 12:06:29.593 NotebookApp] Kernel shutdown: f54b51df-59d4-482e-b345-237cc79af9df
[I 12:06:29.594 NotebookApp] Kernel shutdown: 9c95e464-5819-4eb4-ab91-a4e4295520f9
[I 12:06:29.594 NotebookApp] Kernel shutdown: 9ce7272e-1a1a-4f35-8f7d-cb99f5aef1eb

@billreed63 billreed63 added the bug label Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant