jenkinsci / jms-messaging-plugin

https://plugins.jenkins.io/jms-messaging
12 stars 38 forks source link

sendCIMessage gets stuck running when given nonexistent provider #116

Closed wcheang closed 5 years ago

wcheang commented 5 years ago

Hi,

I was using sendCIMessage in the Jenkins pipeline script, and made a mistake on the providerName. The job got stuck running at the send message step until I killed it, and it wasn't clear to me why it was doing that since there were no errors. The plugin should fail gracefully and with an error message that indicates wrong/nonexistent provider.

Thanks, Wai

wcheang commented 5 years ago

Just to give a bit more details, this is what the part of the pipeline script looks like when I send the message:

            post {
                always {
                    sendCIMessage \
                      messageType: "Custom", \
                      messageProperties: "service=ServiceName", \
                      providerName: 'Some Provider', \
                      messageContent: '$SOME_RESULT', \
                      failOnError: true, \
                      overrides: [topic: 'VirtualTopic.eng.some.topic.result']
                }
            }

I also just ran into a situation where the job failed and so $SOME_RESULT was not set, and the job got stuck in sending the message as well, so it's not just limited to invalid providerName.

ggallen commented 5 years ago

@wcheang , I have a fix for the bad provider name. An exception will be raised so you'll be notified that there is a problem.

However, I am unable to reproduce the problem with the message content variable not being set. That does not hang for me, and a message gets sent. Are you sure when you ran into this problem that you had a valid provider name specified?

wcheang commented 5 years ago

Awesome, thanks for the fix @ggallen! Yeah I can't reproduce the invalid messageContent problem anymore, maybe I did have the wrong provider and mistook it as a different problem.