Skip to content

Panic when trying to open terminal session #3870

Closed
@skerit

Description

@skerit

Coder version & template

I'm using coder v0.8.11.
The template in question is the docker-code-server example template.
(The only thing I changed in it was the DNS setting)

Error

When I try to open a terminal session via the web interface, my docker container crashes with this error:

[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x120d8a5],
panic: runtime error: invalid memory address or nil pointer dereference,
2022-09-05 10:14:27.027 [DEBUG]	<./peer/channel.go:128>	(*Channel).init.func3	datachannel opening	{"id": 5, "label": "65bfa104-41da-4399-a059-d3738f521653:80:80:"},
2022-09-05 10:14:27.027 [WARN]	<./agent/agent.go:744>	(*agent).handleReconnectingPTY	start reconnecting pty command	{"id": "65bfa104-41da-4399-a059-d3738f521653"},
2022-09-05 10:14:27.035 [INFO]	<./cli/agent.go:73>	workspaceAgent.func1	reaper process exiting,
	/home/runner/work/coder/coder/agent/agent.go:775 +0x83b,
created by github.com/coder/coder/agent.(*agent).handleReconnectingPTY,
github.com/coder/coder/agent.(*agent).handleReconnectingPTY.func2(),
	/home/runner/work/coder/coder/agent/agent.go:778 +0x25,
goroutine 1268 [running]:,

And when I try to connect using coder ssh testspace it just fails:

2022-09-05 10:24:49.061 [DEBUG]	<./peer/conn.go:241>	(*Conn).init.func5	dtls transport state updated	{"state": "connected"}
2022-09-05 10:24:49.062 [DEBUG]	<./peer/conn.go:201>	(*Conn).init.func3.1	rtc connection updated	{"state": "connected"}
2022-09-05 10:24:49.062 [DEBUG]	<./peer/channel.go:128>	(*Channel).init.func3	datachannel opening	{"id": 1, "label": "ping"}
2022-09-05 10:24:49.062 [DEBUG]	<./peer/channel.go:128>	(*Channel).init.func3	datachannel opening	{"id": 2, "label": "echo"}
2022-09-05 10:24:49.063 [DEBUG]	<./peer/channel.go:128>	(*Channel).init.func3	datachannel opening	{"id": 3, "label": "ssh"}
2022-09-05 10:24:49.070 [WARN]	<./agent/agent.go:481>	(*agent).init.func2	ssh session failed ...
  "error": start command:
               github.com/coder/coder/agent.(*agent).handleSSHSession
                   /home/runner/work/coder/coder/agent/agent.go:663
             - start:
               github.com/coder/coder/pty.startPty
                   /home/runner/work/coder/coder/pty/start_other.go:41
             - fork/exec /bin/bash: no such file or directory

Opening a console via docker just works though. (And /bin/bash exists just fine)

Also...

I can't open code-server either, not sure if it's a related issue:

code-server is offline!
remote dial error: dial 'tcp://localhost:8080': dial tcp 127.0.0.1:8080: connect: connection refused

Which might be because the agent can't seem to connect to coder?
I'm getting a failed to dial error in the logs, immediately after starting the workspace:


2022-09-05 10:13:06.929 [WARN]	<./agent/agent.go:150>	(*agent).run	failed to dial	{"error": "GET https://coder.domain.be/api/v2/workspaceagents/me/metadata: unexpected status code 401: Agent token is invalid.: Try logging in using 'coder login \u003curl\u003e'."},
2022-09-05 10:13:06.927 [INFO]	<./agent/agent.go:141>	(*agent).run	connecting,
2022-09-05 10:13:06.604 [INFO]	<./agent/agent.go:450>	(*agent).init	generating host key,
2022-09-05 10:13:06.581 [INFO]	<./cli/agent.go:78>	workspaceAgent.func1	starting agent	{"url": "https://coder.domain.be/", "auth": "token", "version": "v0.8.11+cde036c"},
2022-09-05 10:13:06.513 [INFO]	<./cli/agent.go:63>	workspaceAgent.func1	spawning reaper process

After restarting the workspace, I'm getting slightly different agent errors:

2022-09-05 10:58:46.515 [WARN]	<./agent/agent.go:170>	(*agent).run.func1	agent script failed ...,
  "error": run:,
               github.com/coder/coder/agent.(*agent).runStartupScript,
                   /home/runner/work/coder/coder/agent/agent.go:375,
             - chdir /home/skerit: no such file or directory,
2022-09-05 10:58:46.516 [DEBUG]	(tailnet.wgengine)	<./tailnet/conn.go:521>	Logger.func1	[v1] using fake (no-op) tun device,
2022-09-05 10:58:46.518 [DEBUG]	(tailnet.wgengine)	<./tailnet/conn.go:521>	Logger.func1	[v1] magicsock: starting endpoint update (derp-map-update),
2022-09-05 10:58:46.516 [DEBUG]	(tailnet.wgengine)	<./tailnet/conn.go:521>	Logger.func1	[v1] using fake (no-op) OS network configurator,
2022-09-05 10:58:46.516 [DEBUG]	(tailnet.wgengine)	<./tailnet/conn.go:521>	Logger.func1	[v1] using fake (no-op) DNS configurator,
2022-09-05 10:58:46.516 [DEBUG]	(tailnet.wgengine)	<./tailnet/conn.go:521>	Logger.func1	dns: using dns.noopManager
...
2022-09-05 10:58:46.623 [WARN]	<./agent/agent.go:320>	(*agent).runWebRTCNetworking	failed to dial ...,
  "error": GET https://coder.domain.be/api/v2/workspaceagents/me/listen: unexpected status code 403: Agent trying to connect from non-latest build.,
           	Error: build is outdated,

Weird that now the error turned into a Agent trying to connect from non-latest build error, when the template has not been changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiArea: HTTP API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions