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

Fix SEGV when using dynamic addresses. #198

Closed
wants to merge 1 commit into from

Conversation

alanconway
Copy link
Contributor

Fixes #197

Signed-off-by: Alan Conway aconway@redhat.com

Copy link
Owner

@vcabbage vcabbage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thank you!

l.target = new(target)
}
return l.target
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with init methods, but I'd like to avoid getters returning pointers that are then modified.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These aren't initers, this is constructing a blank object demand. There are many places where you want to set a target/source field, but first have to make sure the target/source exists. I think a method for that is better than repeating the if target == nil {} logic everywhere - that's how the SEGV was caused - in one place someone forgot it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I stated, I disagree and won't be merging this.

local_test.go Show resolved Hide resolved
local_test.go Show resolved Hide resolved
local_test.go Show resolved Hide resolved
local_test.go Show resolved Hide resolved
m.Accept()
}()

s, err := ssn.NewSender(amqp.LinkAddress(r.Address()))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err isn't checked

Fixes  vcabbage#197

Signed-off-by: Alan Conway <aconway@redhat.com>
alanconway added a commit to alanconway/vcabbage-amqp that referenced this pull request Dec 5, 2019
example_server_test.go: very simple one-queue broker, tests basic send/receive.

- Lots of unfinished stuff: grep for FIXME to see known holes.
- Needs much more testing, performance profiling etc.

Depends on the following pending PRs, must be re-based after they merge:

- vcabbage#204  Improved debug logging.
- vcabbage#203  Make conn.Close() wait till shutdown is complete.
- vcabbage#201  Rename Client to Conn
- vcabbage#198  Fix SEGV when using dynamic addresses.

Signed-off-by: Alan Conway <aconway@redhat.com>
@vcabbage vcabbage mentioned this pull request Dec 9, 2019
@vcabbage vcabbage closed this Dec 10, 2019
@alanconway
Copy link
Contributor Author

alanconway commented Dec 11, 2019

Fixed all comments except for the on-demand construction getters for target/source objects, which I think are better than manually repeating the if c.x == nil { c.x = new(X) }; c.x.foo = bar pattern.

alanconway added a commit to alanconway/vcabbage-amqp that referenced this pull request Dec 11, 2019
example_server_test.go: very simple one-queue broker, tests basic send/receive.

- Lots of unfinished stuff: grep for FIXME to see known holes.
- Needs much more testing, performance profiling etc.

Depends on the following pending PRs, must be re-based after they merge:

- vcabbage#204  Improved debug logging.
- vcabbage#203  Make conn.Close() wait till shutdown is complete.
- vcabbage#201  Rename Client to Conn
- vcabbage#198  Fix SEGV when using dynamic addresses.

Signed-off-by: Alan Conway <aconway@redhat.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using dynamic address causes SEGV
2 participants