jupyter / kernel_gateway_demos

Demos associated with the kernel gateway incubator project
BSD 3-Clause "New" or "Revised" License
150 stars 76 forks source link

NodeJS demo fails #38

Open dockter-84 opened 7 years ago

dockter-84 commented 7 years ago

When following the instruction on https://github.com/jupyter/kernel_gateway_demos/blob/master/node_client_example/README.md, the following error is returned:

$  docker-compose up
Creating network "nodeclientexample_default" with the default driver
Creating nodeclientexample_kernel_gateway_1
Creating nodeclientexample_nginx_1
Creating nodeclientexample_client_1
Attaching to nodeclientexample_kernel_gateway_1, nodeclientexample_nginx_1, nodeclientexample_client_1
client_1          | Targeting server: http://nginx/jupyter/v1/12345678-1234-1234-1234-123456789012
client_1          | Using example code: example.py
client_1          | ajaxSettings:  { user: 'fakeuser', password: 'fakepass' }
nginx_1           | 2016/10/19 13:46:50 [error] 12#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.4, server: kernel_gateway, request: "GET /jupyter/v1/12345678-1234-1234-1234-123456789012/api/kernelspecs?1476884810574 HTTP/1.1", upstream: "http://172.18.0.2:8888/api/kernelspecs?1476884810574", host: "nginx"
nginx_1           | 172.18.0.4 - fakeuser [19/Oct/2016:13:46:50 +0000] "GET /jupyter/v1/12345678-1234-1234-1234-123456789012/api/kernelspecs?1476884810574 HTTP/1.1" 502 172 "-" "node-XMLHttpRequest"
client_1          | Error fetching kernel specs: null
nodeclientexample_client_1 exited with code 1
kernel_gateway_1  | [KernelGatewayApp] The Jupyter Kernel Gateway is running at: http://0.0.0.0:8888
dockter-84 commented 7 years ago

However, the following did work:

docker-compose run -e DEMO_LANG=python client
parente commented 7 years ago

I remember writing a response here, but now that I'm going around cleaning up open issues, I see I must have never hit the submit button.

The nodejs client example does work for me, but not on the first run. There's a timing issue between the KG server being ready to receive requests and the client making the request. Running the client after the other containers are ready always works.

I don't think docker-compose supports bringing up two out of three containers in the initial up. That would be the simplest fix. Other potential approaches include documenting this behavior, adding a (flaky) sleep to the client, having the client retry the request some number of times.

nscozzaro commented 5 years ago

The node_client_example is giving me the following error:

Nicolass-MacBook-Pro:node_client_example nicolasscozzaro$ docker-compose up
Creating network "node_client_example_default" with the default driver
Creating node_client_example_kernel_gateway_1 ... error

ERROR: for node_client_example_kernel_gateway_1  Cannot start service kernel_gateway: b'driver failed programming external connectivity on endpoint node_client_example_kernel_gateway_1 (58d04c3cf7a16107cf9a681097d004f96d188120a7688dfed9bccaf35d3de153): Bind for 0.0.0.0:8888 failed: port is already allocated'

ERROR: for kernel_gateway  Cannot start service kernel_gateway: b'driver failed programming external connectivity on endpoint node_client_example_kernel_gateway_1 (58d04c3cf7a16107cf9a681097d004f96d188120a7688dfed9bccaf35d3de153): Bind for 0.0.0.0:8888 failed: port is already allocated'