jenkinsci / hipchat-plugin

HipChat notification plugin for Jenkins
https://plugins.jenkins.io/hipchat/
54 stars 85 forks source link

Messages failing #108

Open royceking opened 7 years ago

royceking commented 7 years ago

I occasionally have messages that don't get sent with a job is successful. I can't find why the message get sent most the time, but randomly won't get sent. All I can attribute it to is this stack trace. But this just looks like a warning and not something that would make the message not send.

May 05, 2017 4:21:45 PM jenkins.plugins.hipchat.impl.DefaultCardProvider getCard WARNING: Failed to resolve token macros org.jenkinsci.plugins.tokenmacro.MacroEvaluationException: Unrecognized macro 'TEST_COUNTS' in '${TEST_COUNTS,var="pass"}' at org.jenkinsci.plugins.tokenmacro.Parser.processToken(Parser.java:317) at org.jenkinsci.plugins.tokenmacro.Action$KiHW1UeqOdqAwZul.run(Unknown Source) at org.parboiled.matchers.ActionMatcher.match(ActionMatcher.java:96) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.matchers.ZeroOrMoreMatcher.match(ZeroOrMoreMatcher.java:39) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.parserunners.BasicParseRunner.run(BasicParseRunner.java:72) at org.parboiled.parserunners.ReportingParseRunner.runBasicMatch(ReportingParseRunner.java:86) at org.parboiled.parserunners.ReportingParseRunner.run(ReportingParseRunner.java:66) at org.parboiled.parserunners.AbstractParseRunner.run(AbstractParseRunner.java:81) at org.parboiled.parserunners.AbstractParseRunner.run(AbstractParseRunner.java:76) at org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:68) at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:204) at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:200) at jenkins.plugins.hipchat.impl.DefaultCardProvider.getAttributes(DefaultCardProvider.java:60) at jenkins.plugins.hipchat.impl.DefaultCardProvider.getCard(DefaultCardProvider.java:37) at jenkins.plugins.hipchat.model.NotificationType.getNotification(NotificationType.java:111) at jenkins.plugins.hipchat.model.NotificationType.getNotification(NotificationType.java:96) at jenkins.plugins.hipchat.HipChatNotifier.publishNotificationIfEnabled(HipChatNotifier.java:328) at jenkins.plugins.hipchat.HipChatNotifier.notifyOnBuildComplete(HipChatNotifier.java:305) at jenkins.plugins.hipchat.HipChatNotifier.perform(HipChatNotifier.java:293) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720) at hudson.model.Build$BuildExecution.cleanUp(Build.java:195) at hudson.model.Run.execute(Run.java:1775) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:404)

Anyone else see the occasional message not send? I don't see anything else in the logs.

fkawa-play commented 7 years ago

Hi, I reproduced same situation that notification message didn't send to HipChat sometimes. Maybe you didn't see following INFO message in console output, right?

[INFO] HipChat notification sent to the following rooms: xxxxxx

jenkins.plugins.hipchat.HipChatNotifier.publishNotificationIfEnabled(HipChatNotifier.java:328, that is, following execution will fail. I'll dig more.

getHipChatService(build).publish(notificationType.getNotification(notificationConfig, build, listener));
royceking commented 7 years ago

fkawa-play that is exactly what happens. It is like it just gets ignored. Thanks for the help.

aldaris commented 7 years ago

@royceking the stacktrace you provided suggests two things:

To ensure that TEST_COUNTS tokens work correctly, install the email-ext Jenkins plugin. I will update the default card provider so that it does not fall over when populating the card attributes with unsupported token macros.

aldaris commented 7 years ago

@fkawa-play I'm not sure I understand what you are describing, but if the plugin reported that the notification was successfully sent, then by definition the messages should have arrived to the HipChat room.

ikari7789 commented 6 years ago

@aldaris doesn't it make more sense to wrap anything that relies on another plugin being installed, such as TEST_COUNTS, in a try/catch clause? Seems silly to spit out stacktrace to the log when it's the expected behavior.

monkpit commented 6 years ago

I am seeing the behavior described (occasionally messages are not sent). I don't get any output in my build log at all when the messages fail, it just "doesn't work".

For example, I'll have a build start, and HipChat gets the message for build start event. I see the message is sent successfully in an [INFO] message in the logs. The build runs, and completes, and then sometimes (regardless of pass/fail of the build) I will not get the message that the build is completed. It seems like around 90% of the messages work as intended, and around 10% fail silently.

From the messages I have noticed failing, it seems to be only the result message that doesn't get sent. It looks like the "build started" message is always sent.

Where should I look to see more info/logs about what is happening during the failures? I am not seeing any stacktraces in the build log / console.

royceking commented 6 years ago

Dido. Still seeing this problem.

-- Royce King

On Mon, Apr 16, 2018 at 9:08 AM, Kyle Pittman notifications@github.com wrote:

I am seeing the behavior described (occasionally messages are not sent). I don't get any output in my build log at all when the messages fail, it just "doesn't work".

For example, I'll have a build start, and HipChat gets the message for build start event. I see the message is sent successfully in an [INFO] message in the logs. The build runs, and completes, and then sometimes (regardless of pass/fail of the build) I will not get the message that the build is completed. It seems like around 90% of the messages work as intended, and around 10% fail silently.

From the messages I have noticed failing, it seems to be only the result message that doesn't get sent. It looks like the "build started" message is always sent.

Where should I look to see more info/logs about what is happening during the failures?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jenkinsci/hipchat-plugin/issues/108#issuecomment-381638405, or mute the thread https://github.com/notifications/unsubscribe-auth/AAvxd9XHirtbEvQjEM8m54mUEq1-7QDeks5tpLPygaJpZM4NSfba .

jmcshane commented 6 years ago

I see this message as well and its really becoming a pain in the Jenkins logs when debugging other issues. Any ideas on what we could do to help with this issue?

monkpit commented 6 years ago

I think the source of this issue is when the status of a build is “returned to normal” it doesn’t count as “passed”. So if you don’t have “returned to normal” status set up to report, you will be missing a message in HipChat for the build result.

What I did was go into my Jenkins build and just enabled all messages to try and see what was going wrong. Since doing this I have not had any missed messages.

I guess this is working as designed, however I would expect the “passed” category to automatically include the “returned to normal” category of messages. It’s a bit strange that they are not included.

royceking commented 6 years ago

I see the issue a lot when I have two of the same job running at the same time. The one that finishes first reports to Hipchat and then the one that finishes second does not.