Skip to content

Panic SIGSEGV trying to land or retire local worker #2135

Closed

Description

@Temikus

Bug Report

  • Concourse version: 3.10.0
  • Deployment type (BOSH/Docker/binary): binary via systemd unit, both worker and TSA are running on the same machine
  • Infrastructure/IaaS: GCP
  • Browser (if applicable): N/A
  • Did this used to work? Not sure, first time setting up concourse after those were introduced.
$ concourse land-worker --name concourse
{"timestamp":"1523160334.815049648","source":"land-worker","message":"land-worker.setting-up-beacon-runner","log_level":0,"data":{}}
{"timestamp":"1523160334.815135479","source":"land-worker","message":"land-worker.land-worker","log_level":0,"data":{}}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x59c6a5]

goroutine 6 [running]:
crypto/rsa.(*PrivateKey).Public(0x0, 0xc4200b8868, 0xc420685b28)
	/usr/local/go/src/crypto/rsa/rsa.go:92 +0x5
golang.org/x/crypto/ssh.NewSignerFromSigner(0x7f8fe85f8480, 0x0, 0x0, 0x7f8fe85f8480, 0x0, 0x1)
	/tmp/build/9674af12/concourse/src/golang.org/x/crypto/ssh/keys.go:681 +0x35
golang.org/x/crypto/ssh.NewSignerFromKey(0x19b4e60, 0x0, 0x197858c, 0xe, 0x2540be400, 0x130a4200)
	/tmp/build/9674af12/concourse/src/golang.org/x/crypto/ssh/keys.go:656 +0x163
github.com/concourse/worker/beacon.(*sshClient).Dial(0xc4206373b0, 0x0, 0xc42006fdc8, 0x53b31d, 0xc4204b7418)
	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/client_ssh.go:38 +0x193
github.com/concourse/worker/beacon.(*Beacon).run(0xc4204083c0, 0x1b92da9, 0xb, 0xc4200984e0, 0xc420098540, 0x0, 0x0)
	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/beacon.go:93 +0x5d
github.com/concourse/worker/beacon.(*Beacon).LandWorker(0xc4204083c0, 0xc4200984e0, 0xc420098540, 0x0, 0x0)
	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/beacon.go:89 +0x94
github.com/concourse/worker/beacon.(*Beacon).LandWorker-fm(0xc4200984e0, 0xc420098540, 0x0, 0x0)
	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/land/land_runner.go:40 +0x3e
github.com/tedsuo/ifrit.RunFunc.Run(0xc42044bc00, 0xc4200984e0, 0xc420098540, 0x0, 0x0)
	/tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/runner.go:36 +0x3a
github.com/tedsuo/ifrit.(*process).run(0xc42037f440)
	/tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/process.go:71 +0x45
created by github.com/tedsuo/ifrit.Background
	/tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/process.go:49 +0x107
$ concourse retire-worker --name concourse
{"timestamp":"1523160644.815204859","source":"retire-worker","message":"retire-worker.setting-up-beacon-runner","log_level":0,"data":{}}
{"timestamp":"1523160644.815549850","source":"retire-worker","message":"retire-worker.retire-worker","log_level":0,"data":{}}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x59c6a5]

goroutine 7 [running]:
crypto/rsa.(*PrivateKey).Public(0x0, 0xc4200b8868, 0xc420535b28)
	/usr/local/go/src/crypto/rsa/rsa.go:92 +0x5
golang.org/x/crypto/ssh.NewSignerFromSigner(0x7fb2b099ec80, 0x0, 0x0, 0x7fb2b099ec80, 0x0, 0x1)
	/tmp/build/9674af12/concourse/src/golang.org/x/crypto/ssh/keys.go:681 +0x35
golang.org/x/crypto/ssh.NewSignerFromKey(0x19b4e60, 0x0, 0x197858c, 0xe, 0x2540be400, 0x130a4200)
	/tmp/build/9674af12/concourse/src/golang.org/x/crypto/ssh/keys.go:656 +0x163
github.com/concourse/worker/beacon.(*sshClient).Dial(0xc42064b440, 0x0, 0xc42006fdc8, 0x53b31d, 0xc42050f558)
	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/client_ssh.go:38 +0x193
github.com/concourse/worker/beacon.(*Beacon).run(0xc420402640, 0x1b966c6, 0xd, 0xc4200984e0, 0xc420098540, 0x0, 0x0)
	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/beacon.go:93 +0x5d
github.com/concourse/worker/beacon.(*Beacon).RetireWorker(0xc420402640, 0xc4200984e0, 0xc420098540, 0x0, 0x0)
	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/beacon.go:84 +0x94
github.com/concourse/worker/beacon.(*Beacon).RetireWorker-fm(0xc4200984e0, 0xc420098540, 0x0, 0x0)
	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/retire/retire_runner.go:40 +0x3e
github.com/tedsuo/ifrit.RunFunc.Run(0xc42004b290, 0xc4200984e0, 0xc420098540, 0x0, 0x0)
	/tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/runner.go:36 +0x3a
github.com/tedsuo/ifrit.(*process).run(0xc420389d40)
	/tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/process.go:71 +0x45
created by github.com/tedsuo/ifrit.Background
	/tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/process.go:49 +0x107
$ uname -a
Linux concourse 4.13.0-1012-gcp #16-Ubuntu SMP Thu Mar 15 12:00:42 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"

If there's anything additional I can help with or provide - please, let me know.

Activity

  1. queer commented on Apr 8, 2018

    @queer

    Getting this same thing trying to use the docker-compose file at https://github.com/concourse/concourse-docker/blob/master/docker-compose.yml

    Concourse version: 3.10.0
    Deployment type (BOSH/Docker/binary): Docker, all on one machine
    Infrastructure/IaaS: OVH dedicated server
    Browser (if applicable): N/A
    Did this used to work? No idea; first time using concourse on this box.

    This is happening on initial setup; can't get a working install at all.

    root@server-1:~# docker -v
    Docker version 17.03.2-ce, build f5ec1e2
    
    root@server-1:~# uname -a
    Linux server-1 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
    
    root@server-1:~# lsb_release -a
    No LSB modules are available.
    Distributor ID:	Ubuntu
    Description:	Ubuntu 16.04.4 LTS
    Release:	16.04
    Codename:	xenial
    

    Full error:

    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x838b87]
    
    goroutine 1 [running]:
    crypto/rsa.(*PrivateKey).Public(...)
    	/usr/local/go/src/crypto/rsa/rsa.go:92
    github.com/concourse/flag.PrivateKey.Public(0x0, 0x538d9a, 0xc420665440)
    	<autogenerated>:1 +0x17
    golang.org/x/crypto/ssh.NewSignerFromSigner(0x7fe31ba71e20, 0x0, 0x0, 0x7fe31ba71e20, 0x0, 0x412f01)
    	/tmp/build/9674af12/concourse/src/golang.org/x/crypto/ssh/keys.go:681 +0x35
    golang.org/x/crypto/ssh.NewSignerFromKey(0x1a0a360, 0x0, 0x412f68, 0x30, 0x1ab2280, 0xc420665508)
    	/tmp/build/9674af12/concourse/src/golang.org/x/crypto/ssh/keys.go:656 +0x163
    github.com/concourse/tsa/tsacmd.(*TSACommand).configureSSHServer(0xc4201c23c0, 0xc42046ea50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc42019a700, 0xc420594540, ...)
    	/tmp/build/9674af12/concourse/src/github.com/concourse/tsa/tsacmd/command.go:176 +0x18e
    github.com/concourse/tsa/tsacmd.(*TSACommand).Runner(0xc4201c23c0, 0xc420446290, 0x0, 0x1, 0x1290a1e0, 0xc424e45ce0, 0x0, 0x0)
    	/tmp/build/9674af12/concourse/src/github.com/concourse/tsa/tsacmd/command.go:76 +0x237
    main.(*WebCommand).Runner(0xc4205af808, 0xc420446290, 0x0, 0x1, 0x83d871, 0xc42043ce80, 0xc420685768, 0x83ddc0)
    	/tmp/build/9674af12/concourse/src/github.com/concourse/bin/cmd/concourse/web.go:60 +0x10b
    main.(*WebCommand).Execute(0xc4205af808, 0xc420446290, 0x0, 0x1, 0x18e5100, 0x1b04800)
    	/tmp/build/9674af12/concourse/src/github.com/concourse/bin/cmd/concourse/web.go:39 +0x4d
    github.com/vito/twentythousandtonnesofcrudeoil.installEnv.func2(0x7fe31b993950, 0xc4205af808, 0xc420446290, 0x0, 0x1, 0x1, 0xc4206858b0)
    	/tmp/build/9674af12/concourse/src/github.com/vito/twentythousandtonnesofcrudeoil/environment.go:40 +0x8a
    github.com/jessevdk/go-flags.(*Parser).ParseArgs(0xc42004ac00, 0xc4200d4010, 0x1, 0x1, 0xc420685948, 0x83d6cf, 0xc42004ac00, 0x1b4e5c2, 0xa)
    	/tmp/build/9674af12/concourse/src/github.com/jessevdk/go-flags/parser.go:314 +0x7c7
    github.com/jessevdk/go-flags.(*Parser).Parse(0xc42004ac00, 0x1b4e5c2, 0xa, 0xc420408c00, 0x0, 0x0)
    	/tmp/build/9674af12/concourse/src/github.com/jessevdk/go-flags/parser.go:186 +0x71
    main.main()
    	/tmp/build/9674af12/concourse/src/github.com/concourse/bin/cmd/concourse/main.go:32 +0x1b1
    

    This above error is the only thing to show up in the logs.


    Didn't feel that this was worth adding another comment for, so edit:

    Starting with quickstart works fine, so I guess it's specifically an issue with handling the priv/pub keys. I think I'm just a moron who forgot to generate the keys; in this case I guess the error could be clearer?

  2. edtan commented on Apr 13, 2018

    @edtan
    Contributor

    I was getting the same SIGSEGV error when running concourse land-worker --name worker. However, I got it working by providing the TSA configuration parameters, e.g. concourse land-worker --name worker --tsa-public-key keys/web/tsa_host_key.pub --tsa-worker-private-key keys/worker/worker_key

  3. self-assigned this
    on Apr 27, 2018
  4. shashwathi commented on Apr 27, 2018

    @shashwathi
    Contributor

    Looks like in few parts of code we are not checking for TSA config correctly.

    Eg: https://github.com/concourse/worker/blob/master/beacon/client_ssh.go#L42
    We need to check if WorkerPrivateKey is not nill before accessing PrivateKey variable.

    Thank you so much for reporting this issue. I will look into this.

  5. added 2 commits that reference this issue on May 3, 2018
  6. shashwathi commented on May 4, 2018

    @shashwathi
    Contributor

    For acceptance @jama-pivotal

    Previous behaviour concourse land-worker --name test-worker would panic without clear msg as to why it failed.

    Updated behaviour the command will fail with error msg public worker key is not provided. Similar update to retire-worker,

  7. added 2 commits that reference this issue on May 4, 2018
  8. eltoru commented on May 7, 2018

    @eltoru

    Had same problem. Running concourse web and worker by use of docker composer. Tried with different concourse version 3.11.0, 3.10.0 and 3.9.2. Finaly with older version, I got a valid output, telling that ssh keys had wrong permissions. As the keys were generated by another user than the docker server user, and that they are volume mounted in, it seems that permissions for them are not open enouch for the concourse container that are useing them.

    Solved by chmod generated keys in current working directory with 744, before starting up concourse with: docker-compose -f docker-compose.yml up

  9. StoyanIvanovI commented on May 15, 2018

    @StoyanIvanovI

    I can confirm the solution provided by @eltoru solves the problem. I had the same issue with ECS containers but the key commonality was that I used keys generated on another EC2 instance. After regenerating the keys, everything works okay. Thanks a lot for the suggestion.

  10. modified the milestone: v3.14.0 on Jun 5, 2018
  11. eedwards-sk commented on Aug 8, 2018

    @eedwards-sk

    Still getting this on 4.0.0, likely due to missing keys in the command as per above

    # concourse retire-worker --name bd0c37eb5fdd
    {"timestamp":"1533744111.954956293","source":"retire-worker","message":"retire-worker.beacon.setting-up-beacon-runner","log_level":0,"data":{"session":"1"}}
    {"timestamp":"1533744111.955165863","source":"retire-worker","message":"retire-worker.beacon.retire-worker","log_level":0,"data":{"session":"1"}}
    {"timestamp":"1533744111.955272198","source":"retire-worker","message":"retire-worker.beacon.command-to-run","log_level":0,"data":{"cmd":"retire-worker","session":"1"}}
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xffc135]
    
    goroutine 41 [running]:
    crypto/rsa.(*PrivateKey).Public(0x0, 0xc4200d2418, 0xc420731ac0)
    	/usr/local/go/src/crypto/rsa/rsa.go:92 +0x5
    golang.org/x/crypto/ssh.NewSignerFromSigner(0x7f9543ac6d00, 0x0, 0x0, 0x7f9543ac6d00, 0x0, 0x1)
    	/tmp/build/9674af12/concourse/src/golang.org/x/crypto/ssh/keys.go:681 +0x35
    golang.org/x/crypto/ssh.NewSignerFromKey(0x2979c40, 0x0, 0x29235de, 0xe, 0x2540be400, 0x1443a380)
    	/tmp/build/9674af12/concourse/src/golang.org/x/crypto/ssh/keys.go:656 +0x163
    github.com/concourse/worker/beacon.(*sshClient).Dial(0xc42035e630, 0x2bb8de5, 0xe, 0xc4200d2400, 0x1)
    	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/client_ssh.go:45 +0x105
    github.com/concourse/worker/beacon.(*Beacon).run(0xc4200c4160, 0x2bb7782, 0xd, 0xc4201b0120, 0xc4201b0180, 0x0, 0x0)
    	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/beacon.go:298 +0x198
    github.com/concourse/worker/beacon.(*Beacon).RetireWorker(0xc4200c4160, 0xc4201b0120, 0xc4201b0180, 0x0, 0x0)
    	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/beacon.go:114 +0x94
    github.com/concourse/worker/beacon.(BeaconClient).RetireWorker-fm(0xc4201b0120, 0xc4201b0180, 0x0, 0x0)
    	/tmp/build/9674af12/concourse/src/github.com/concourse/worker/retire/retire_runner.go:40 +0x43
    github.com/tedsuo/ifrit.RunFunc.Run(0xc4206910e0, 0xc4201b0120, 0xc4201b0180, 0x0, 0x0)
    	/tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/runner.go:36 +0x3a
    github.com/tedsuo/ifrit.(*process).run(0xc4200d6c40)
    	/tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/process.go:71 +0x45
    created by github.com/tedsuo/ifrit.Background
    	/tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/process.go:49 +0x107
    

    Edit: Are we supposed to be landing from the web container or from the worker container?

    The command indicates it needs the worker private key, but the worker private key is not stored on the web container.

  12. metacoma commented on Oct 26, 2018

    @metacoma

    faced with the same issue, concourse version 4.2.1

    # concourse land-worker --name concourse-worker-1 concourse-worker-0 --tsa-public-key=./worker-key-pub
    {"timestamp":"1540567721.369747639","source":"land-worker","message":"land-worker.beacon.setting-up-beacon-runner","log_level":0,"data":{"session":"1"}}
    {"timestamp":"1540567721.369885206","source":"land-worker","message":"land-worker.beacon.land-worker","log_level":0,"data":{"session":"1"}}
    {"timestamp":"1540567721.369953632","source":"land-worker","message":"land-worker.beacon.command-to-run","log_level":0,"data":{"cmd":"land-worker","session":"1"}}
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xfe3485]
    
    goroutine 25 [running]:
    crypto/rsa.(*PrivateKey).Public(0x0, 0xc0000ce760, 0xc000e09ae8)
            /usr/local/go/src/crypto/rsa/rsa.go:100 +0x5
    golang.org/x/crypto/ssh.NewSignerFromSigner(0x7f6c37fdf770, 0x0, 0x0, 0x7f6c37fdf770, 0x0, 0x1)
            /tmp/build/9674af12/concourse/src/golang.org/x/crypto/ssh/keys.go:681 +0x35
    golang.org/x/crypto/ssh.NewSignerFromKey(0x29eac80, 0x0, 0x296ac7e, 0xe, 0x2540be400, 0x17e0ae80)
            /tmp/build/9674af12/concourse/src/golang.org/x/crypto/ssh/keys.go:656 +0x16a
    github.com/concourse/worker/beacon.(*sshClient).Dial(0xc000740360, 0x2bd052e, 0xe, 0xc0000ce750, 0x1)
            /tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/client_ssh.go:45 +0x105
    github.com/concourse/worker/beacon.(*Beacon).run(0xc0006c5760, 0x2bcac4c, 0xb, 0xc0000b4240, 0xc0000b4360, 0x0, 0x0)
            /tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/beacon.go:298 +0x192
    github.com/concourse/worker/beacon.(*Beacon).LandWorker(0xc0006c5760, 0xc0000b4240, 0xc0000b4360, 0x0, 0x0)
            /tmp/build/9674af12/concourse/src/github.com/concourse/worker/beacon/beacon.go:283 +0x94
    github.com/concourse/worker/beacon.BeaconClient.LandWorker-fm(0xc0000b4240, 0xc0000b4360, 0x0, 0x0)
            /tmp/build/9674af12/concourse/src/github.com/concourse/worker/land/land_runner.go:40 +0x43
    github.com/tedsuo/ifrit.RunFunc.Run(0xc0005e2fa0, 0xc0000b4240, 0xc0000b4360, 0x0, 0x0)
            /tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/runner.go:36 +0x3a
    github.com/tedsuo/ifrit.(*process).run(0xc000ddfd00)
            /tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/process.go:71 +0x45
    created by github.com/tedsuo/ifrit.Background
            /tmp/build/9674af12/concourse/src/github.com/tedsuo/ifrit/process.go:49 +0xf6
    
  13. metacoma commented on Oct 26, 2018

    @metacoma

    metacoma unassigned shashwathi just now

    sorry folks, missclick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions