Skip to content
This repository was archived by the owner on Dec 14, 2020. It is now read-only.
This repository was archived by the owner on Dec 14, 2020. It is now read-only.

Using dynamic address causes SEGV #197

Description

@alanconway

Test code

func TestSendReceive(t *testing.T) {
	c, err := amqp.Dial("amqp://")
	require.NoError(t, err)
	defer c.Close()
	ssn, err := c.NewSession()
	require.NoError(t, err)
	r, err := ssn.NewReceiver(amqp.LinkAddressDynamic())
	require.NoError(t, err)
	s, err := ssn.NewSender(amqp.LinkAddress(r.Address()))
	require.NoError(t, s.Send(context.Background(), amqp.NewMessage([]byte("hello"))))
	m, err := r.Receive(context.Background())
	require.NoError(t, err)
	assert.Equal(t, "hello", string(m.GetData()))
}

Result:

--- FAIL: TestSendReceive (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x6b71dd]

goroutine 248 [running]:
testing.tRunner.func1(0xc0002cc000)
	/usr/lib/golang/src/testing/testing.go:874 +0x3a3
panic(0x7dfca0, 0xb64460)
	/usr/lib/golang/src/runtime/panic.go:679 +0x1b2
pack.ag/amqp.attachLink(0xc000290180, 0xc0002a8040, 0xc0000edf58, 0x1, 0x1, 0x0, 0x0, 0x0)
	/home/aconway/go/src/pack.ag/amqp/client.go:981 +0x54d
pack.ag/amqp.(*Session).NewReceiver(0xc000290180, 0xc0000edf58, 0x1, 0x1, 0x0, 0x0, 0x0)
	/home/aconway/go/src/pack.ag/amqp/client.go:311 +0x81
pack.ag/amqp_test.TestSendReceive(0xc0002cc000)
	/home/aconway/go/src/pack.ag/amqp/local_test.go:48 +0x1a0
testing.tRunner(0xc0002cc000, 0x86d640)
	/usr/lib/golang/src/testing/testing.go:909 +0xc9
created by testing.(*T).Run
	/usr/lib/golang/src/testing/testing.go:960 +0x350
exit status 2
FAIL	pack.ag/amqp	0.032s

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions