Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rocketchat service segfaults when connection to the server fails #71

Closed
atighineanu opened this issue Nov 5, 2020 · 2 comments · Fixed by #80
Closed

Rocketchat service segfaults when connection to the server fails #71

atighineanu opened this issue Nov 5, 2020 · 2 comments · Fixed by #80
Labels
Service: Rocketchat Related to the Rocketchat service Type: Bug Something isn't working

Comments

@atighineanu
Copy link
Contributor

atighineanu commented Nov 5, 2020

By default, send is using the formatted hook, like this "https://%s/hooks/%s/%s", host, tokenA, tokenB. However, in cases when my 443 port is busy with a different service, and I've set the chat service to use port 5000 or 3000, adding the port into the rawURL - it ends up with an error:

Imba-MacBookPro:shoutrrr alexeitighineanu$ go run cli/main.go send --url "rocketchat://shoutrrr@<myhost>:3000/<mytokenA>/<mytokenB>/general" --message "heyheyhey"

[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x13869ea]

goroutine 1 [running]:
github.com/containrrr/shoutrrr/pkg/services/rocketchat.(*Service).Send(0xc0000b8980, 0x7ffeefbff721, 0x9, 0xc0000c0088, 0xc0000b8980, 0x0)
        /Users/alexeitighineanu/go/src/github.com/shoutrrr/pkg/services/rocketchat/rocketchat.go:41 +0x2ea
github.com/containrrr/shoutrrr.Send(0x7ffeefbff6a4, 0x72, 0x7ffeefbff721, 0x9, 0x9, 0x0)
        /Users/alexeitighineanu/go/src/github.com/shoutrrr/shoutrrr.go:24 +0xd7
github.com/containrrr/shoutrrr/cli/cmd/send.Run(0x1913580, 0xc0000dce00, 0x0, 0x4)
        /Users/alexeitighineanu/go/src/github.com/shoutrrr/cli/cmd/send/send.go:49 +0x146
github.com/spf13/cobra.(*Command).execute(0x1913580, 0xc0000dcdc0, 0x4, 0x4, 0x1913580, 0xc0000dcdc0)
        /Users/alexeitighineanu/go/pkg/mod/github.com/spf13/[email protected]/command.go:842 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0x19132e0, 0x0, 0x0, 0x0)
        /Users/alexeitighineanu/go/pkg/mod/github.com/spf13/[email protected]/command.go:943 +0x336
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/alexeitighineanu/go/pkg/mod/github.com/spf13/[email protected]/command.go:883
main.main()
        /Users/alexeitighineanu/go/src/github.com/shoutrrr/cli/main.go:9 +0x31
exit status 2

First, I've noticed there is no proper check if the posting happened without problems --> pkg/services/rocketchat/rocketchat.go:

res, err := http.Post(apiURL, "application/json", bytes.NewReader(json))
	if res.StatusCode != http.StatusOK {
		return fmt.Errorf("failed to send notification to service, response status code %s", res.Status)
	}

A PR is coming right away to address the respective issue.

@atighineanu atighineanu changed the title In case I use a custom port for the chat service shoutrrr shows an error In case I use a custom port for the chat service shoutrrr shows a segfault Nov 5, 2020
@piksel piksel changed the title In case I use a custom port for the chat service shoutrrr shows a segfault Rocketchat service segaults when connection to the server fails Nov 5, 2020
@piksel
Copy link
Member

piksel commented Nov 5, 2020

This is in a way two issues in one. I renamed the issue to point to the part of it that is an actual bug/error.

The reason for why you are seeing this are (as you have figured out) that Rocketchat doesn't support specifying the port, which is more of a feature request.

@piksel piksel added Type: Bug Something isn't working Service: Rocketchat Related to the Rocketchat service labels Nov 5, 2020
@atighineanu
Copy link
Contributor Author

atighineanu commented Nov 14, 2020

I've opened a separated Feature request for this.
#76

This was referenced Nov 15, 2020
simskij pushed a commit that referenced this issue Nov 15, 2020
@simskij simskij changed the title Rocketchat service segaults when connection to the server fails Rocketchat service segfaults when connection to the server fails Nov 15, 2020
JonasPf pushed a commit to Blockdaemon/shoutrrr that referenced this issue Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Service: Rocketchat Related to the Rocketchat service Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants