qa-dev / jsonwire-grid

High-performance scalable implementation of Selenium Grid
MIT License
73 stars 10 forks source link

jsonwire-grid fails to provide session ID #37

Closed jg-repos closed 4 years ago

jg-repos commented 5 years ago

I've followed your How-To guide using the config-local-sample.json configuration file. The grid boots up correctly, and the selenium jar is able to register a node; however, client never receives any session id from the grid when submitting the following POST.

curl -X POST http://127.0.0.1:4444/wd/hub/session -d '{"desiredCapabilities":{"browserName": "firefox"}}'

Instead the grid crashes with the following output

time="2019-05-01T21:14:31Z" level=error msg="Panic: net/http: abort Handler\ngoroutine 50 [running]:\nruntime/debug.Stack(0xc000531758, 0x12fe800, 0xc000030d10)\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0xa7\ngithub.com/qa-dev/jsonwire-grid/middleware.(*Wrap).Do.func1.1(0xc0003e8940)\n\t/go/src/github.com/qa-dev/jsonwire-grid/middleware/wrap.go:32 +0x60\npanic(0x12fe800, 0xc000030d10)\n\t/usr/local/go/src/runtime/panic.go:513 +0x1b9\nnet/http/httputil.(*ReverseProxy).ServeHTTP(0xc00011a230, 0x1611a00, 0xc000172c30, 0xc0001c0100)\n\t/usr/local/go/src/net/http/httputil/reverseproxy.go:284 +0x1058\ngithub.com/qa-dev/jsonwire-grid/handlers.(*CreateSession).tryCreateSession(0xc0003e89c0, 0xc0001c0100, 0xc000345bb8, 0x13, 0xc0001f4088, 0x1)\n\t/go/src/github.com/qa-dev/jsonwire-grid/handlers/createSession.go:92 +0x396\ngithub.com/qa-dev/jsonwire-grid/handlers.(*CreateSession).ServeHTTP(0xc0003e89c0, 0x1617940, 0xc000240000, 0xc0001c0100)\n\t/go/src/github.com/qa-dev/jsonwire-grid/handlers/createSession.go:60 +0x3e1\ngithub.com/qa-dev/jsonwire-grid/middleware.(*Wrap).Do.func1(0x1617940, 0xc000240000, 0xc0001c0100)\n\t/go/src/github.com/qa-dev/jsonwire-grid/middleware/wrap.go:36 +0x8a\nnet/http.HandlerFunc.ServeHTTP(0xc0003e89e0, 0x1617940, 0xc000240000, 0xc0001c0100)\n\t/usr/local/go/src/net/http/server.go:1964 +0x44\nnet/http.(*ServeMux).ServeHTTP(0x21a2760, 0x1617940, 0xc000240000, 0xc0001c0100)\n\t/usr/local/go/src/net/http/server.go:2361 +0x127\nnet/http.serverHandler.ServeHTTP(0xc00049fa00, 0x1617940, 0xc000240000, 0xc0001c0100)\n\t/usr/local/go/src/net/http/server.go:2741 +0xab\nnet/http.(*conn).serve(0xc0002f0dc0, 0x1618d80, 0xc000072140)\n\t/usr/local/go/src/net/http/server.go:1847 +0x646\ncreated by net/http.(*Server).Serve\n\t/usr/local/go/src/net/http/server.go:2851 +0x2f5\n" component=middlewareWrap

I'm eager to use your application, but I'm unfamiliar with go, so I'm unable to help fix this error. Can you please look into this error?

Note: I used the Dockerfile provided with the repository to install/run jsonwire-grid

Thanks

andrskom commented 5 years ago

Thank u, @mrbub. We check it, but can u add to report your config file?

jg-repos commented 5 years ago

Sure, I stored it as config.json, contents below

{ "logger": { "level": "debug" }, "db": { "implementation": "local" }, "grid": { "client_type": "selenium", "port": 4444, "strategy_list": [ { "type": "persistent" } ], "busy_node_duration": "15m", "reserved_node_duration": "5m" } }

jg-repos commented 5 years ago

I should add that a session is created when registering with the hub using curl -X POST http://127.0.0.1:4444/wd/hub/session -d '{"desiredCapabilities":{"browserName": "firefox"}}'

A firefox WebDriver session opens, but no session details are returned to the client.

Full output from selenium command java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://127.0.0.1:4444/grid/register

08:32:36.575 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358 08:32:36.674 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Launching a Selenium Grid node on port 13088 2019-05-02 08:32:36.746:INFO::main: Logging initialized @350ms to org.seleniumhq.jetty9.util.log.StdErrLog 08:32:36.930 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet 08:32:36.992 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 13088 08:32:36.992 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid node is up and ready to register to the hub 08:32:37.031 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms. 08:32:37.239 WARN [SelfRegisteringRemote.registerToHub] - Error getting the parameters from the hub. The node may end up with wrong timeouts.Error with the JSON of the config : Unable to determine type from: u. Last 1 characters read: u Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'jason-Aspire-V3-575', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-47-generic', java.version: '1.8.0_191' Driver info: driver.version: unknown 08:32:37.239 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://127.0.0.1:4444/grid/register 08:32:37.249 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use 08:33:19.561 INFO [ActiveSessionFactory.apply] - Capabilities are: { "browserName": "firefox" } 08:33:19.562 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService) 1556800399596 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.yLqdBxrsIAsO" 1556800399889 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: resource://pdf.js/ 1556800399889 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid host permission: about:reader* 1556800403204 Marionette INFO Listening on port 2828 08:33:23.326 INFO [ProtocolHandshake.createSession] - Detected dialect: W3C 08:33:23.369 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session b1c98b52-1b3f-4cb6-9cd8-7fa17b31ab7a (org.openqa.selenium.firefox.GeckoDriverService)

full output from jsonwire-grid

hub_1 | time="2019-05-02T12:31:55Z" level=info msg=./config.json hub_1 | time="2019-05-02T12:31:55Z" level=info msg="Set log level to: debug" hub_1 | time="2019-05-02T12:32:37Z" level=info msg="url [/grid/api/hub] parsing error" hub_1 | time="2019-05-02T12:33:19Z" level=info msg="requested session with params: {\"desiredCapabilities\":{\"browserName\": \"firefox\"}}" hub_1 | time="2019-05-02T12:33:23Z" level=info msg="register SessionID: b1c98b52-1b3f-4cb6-9cd8-7fa17b31ab7a on node 172.29.0.1:13088" hub_1 | time="2019-05-02T12:33:23Z" level=error msg="Panic: net/http: abort Handler\ngoroutine 53 [running]:\nruntime/debug.Stack(0xc0005b7758, 0x12fe800, 0xc000030d10)\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0xa7\ngithub.com/qa-dev/jsonwire-grid/middleware.(*Wrap).Do.func1.1(0xc00023cd00)\n\t/go/src/github.com/qa-dev/jsonwire-grid/middleware/wrap.go:32 +0x60\npanic(0x12fe800, 0xc000030d10)\n\t/usr/local/go/src/runtime/panic.go:513 +0x1b9\nnet/http/httputil.(*ReverseProxy).ServeHTTP(0xc0001c6ff0, 0x1611a00, 0xc0002e29f0, 0xc0004ac700)\n\t/usr/local/go/src/net/http/httputil/reverseproxy.go:284 +0x1058\ngithub.com/qa-dev/jsonwire-grid/handlers.(*CreateSession).tryCreateSession(0xc00023cd80, 0xc0004ac700, 0xc00053dbb8, 0x13, 0xc0002ce7d8, 0x1)\n\t/go/src/github.com/qa-dev/jsonwire-grid/handlers/createSession.go:92 +0x396\ngithub.com/qa-dev/jsonwire-grid/handlers.(*CreateSession).ServeHTTP(0xc00023cd80, 0x1617940, 0xc000404460, 0xc0004ac700)\n\t/go/src/github.com/qa-dev/jsonwire-grid/handlers/createSession.go:60 +0x3e1\ngithub.com/qa-dev/jsonwire-grid/middleware.(*Wrap).Do.func1(0x1617940, 0xc000404460, 0xc0004ac700)\n\t/go/src/github.com/qa-dev/jsonwire-grid/middleware/wrap.go:36 +0x8a\nnet/http.HandlerFunc.ServeHTTP(0xc00023cda0, 0x1617940, 0xc000404460, 0xc0004ac700)\n\t/usr/local/go/src/net/http/server.go:1964 +0x44\nnet/http.(*ServeMux).ServeHTTP(0x21a2760, 0x1617940, 0xc000404460, 0xc0004ac700)\n\t/usr/local/go/src/net/http/server.go:2361 +0x127\nnet/http.serverHandler.ServeHTTP(0xc00008f6c0, 0x1617940, 0xc000404460, 0xc0004ac700)\n\t/usr/local/go/src/net/http/server.go:2741 +0xab\nnet/http.(*conn).serve(0xc000354640, 0x1618d80, 0xc00048c040)\n\t/usr/local/go/src/net/http/server.go:1847 +0x646\ncreated by net/http.(*Server).Serve\n\t/usr/local/go/src/net/http/server.go:2851 +0x2f5\n" component=middlewareWrap

Docker compose file i'm using to launch jsonwire-grid

version: '2' services: hub: hostname: hub build: context: /home/mrbub/Docker/jsonwire-grid dockerfile: Dockerfile ports: