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

FATAL: class jenkins.plugins.slack.SlackNotifier$SlackJobProperty is missing its descriptor since 2.0 #188

Closed
marcmillien opened this issue Mar 15, 2016 · 67 comments

Comments

@marcmillien
Copy link

marcmillien commented Mar 15, 2016

Since the upgrade to 2.0 we have the following error for all our builds:

FATAL: class jenkins.plugins.slack.SlackNotifier$SlackJobProperty is missing its descriptor
java.lang.AssertionError: class jenkins.plugins.slack.SlackNotifier$SlackJobProperty is missing its descriptor
    at jenkins.model.Jenkins.getDescriptorOrDie(Jenkins.java:1223)
    at hudson.model.JobProperty.getDescriptor(JobProperty.java:105)
    at hudson.model.JobProperty.getDescriptor(JobProperty.java:79)
    at hudson.model.Descriptor.toMap(Descriptor.java:973)
    at hudson.model.Job.getProperties(Job.java:558)
    at hudson.model.Build$BuildExecution.post2(Build.java:187)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
    at hudson.model.Run.execute(Run.java:1763)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)

Downgrade to 1.8.1 seems to solve the issue.
Jenkins version: 1.652

See possible fix

edit by @samrocketman: See #191 for possible fixes for this issue.

@kmadel
Copy link
Contributor

kmadel commented Mar 15, 2016

Request for feedback from others that upgraded to 2.0

@josb-mi
Copy link

josb-mi commented Mar 15, 2016

Same error here.

sleepyorion pushed a commit to sleepyorion/build-wf that referenced this issue Mar 15, 2016
…enkinsci/slack-plugin#188, which caused Jenkins from launching properly thus no builds.

By reverting the slack plugin to 1.8.1 resulted in stable Jenkins setup.
@kmadel
Copy link
Contributor

kmadel commented Mar 15, 2016

@josb-mi what version of Jenkins?

@josb-mi
Copy link

josb-mi commented Mar 15, 2016

@kmadel : latest, 1.653

@ptagr
Copy link

ptagr commented Mar 16, 2016

just got the same issue. Jenkins 1.647

@kmadel
Copy link
Contributor

kmadel commented Mar 16, 2016

This used to be a warning from what I can tell, not sure if something changed in core after 1.642???

@OwensCode
Copy link
Contributor

Part of the reason this did not get spotted sooner is that the parent pom for the project is such an old version (1.609.2). I think that also applies to the issue with the newly added webhook functionality. We should update the parent pom version, but that is going to result in some more changes.

@kmadel
Copy link
Contributor

kmadel commented Mar 16, 2016

@OwensCode Any chance you can put together a PR with a fix in the next 6-8 hours? @dpires already has a PR with a possible fix for the webhook issue. I was hoping to do a bug fix 2.0.1 release at around 9PM EDT.

@OwensCode
Copy link
Contributor

I have not been able to repeat the problem so far, so it's hard to say. Trying to fit it into my normal work day, so I'll do what I can. I'll update as soon as possible.

@OwensCode
Copy link
Contributor

I have not been able to replicate the issue with Jenkins 1.652 so far, and the "simple" change that is shown in the documentation (https://wiki.jenkins-ci.org/display/JENKINS/My+class+is+missing+descriptor) and elsewhere is not so simple here because the class already inherits from something else and Java does not support multiple inheritance, so I really need to be able to see it happen so that I can verify that it gets fixed. If anyone who has experienced this problem can think of anything that will help me replicate it, I would greatly appreciate it.

  1. Fresh Jenkins installation
  2. Install and configure 1.8.1 plugin
  3. Create a freestyle job and test that it works and sends out slack messages
  4. Upgrade plugin to 2.0 via the standard upgrade mechanism and restart Jenkins
  5. Run the job and verify that it still sends out notifications

@lukosan
Copy link

lukosan commented Mar 16, 2016

I have a vagrant and ansible script combo that creates an ec2 instance, installs jenkins, install the slack notifier plugin, uploads a config, and then runs a job that reproduces this error message - would that help?

@OwensCode
Copy link
Contributor

Yes, it sounds like it would be. Maybe there is something specific in the config that triggers it.

@kevinlondon
Copy link

If anyone needs the link to downgrade temporarily, I downloaded 1.8.1 manually from here: https://updates.jenkins-ci.org/download/plugins/slack/1.8.1/slack.hpi

Thanks for working on the real fix too 👍

@lukosan
Copy link

lukosan commented Mar 16, 2016

I knocked up a test project here:

https://github.com/lukosan/vagrant-ansible-ec2-jenkins-slack

However, this doesn't reproduce the problem as it works fine :-/

Now, I do have a similar stack that does fail however I can't share it because it's a private corporate stack :-/

However, I do now have one working jenkins box/config and one failing jenkins box/config so I'll do a bit of digging tomorrow morning and try and track down which specific bit of the config is causing the problem and I'll let you know.

@OwensCode
Copy link
Contributor

Although I can't repeat the issue, I can get a unit test to try to retrieve the descriptor and it currently fails to do so. I think if I can get it to pass, then there is a good chance I'll have a fix, so that's what I'll aim at for now.

@samrocketman
Copy link
Member

I've created a script console script which patches the runtime to disable Slack outbound webhooks.

https://github.com/samrocketman/jenkins-script-console-scripts/blob/master/disable-slack-webhooks.groovy

See also https://issues.jenkins-ci.org/browse/JENKINS-33556

@samrocketman
Copy link
Member

I'm able to reliably replicate the issue. I'll post how in a bit while I prep.

@samrocketman
Copy link
Member

Closing this issue in favor of #191.

@OwensCode
Copy link
Contributor

No luck with the changes, and I'm concerned that this is a red herring. I'm suspicious that configs are not being migrated for some reason, and that is the reason for the errors. It would explain why downgrading worked without having to restore the old configurations.

If possible, can somebody post Jenkins logs from when they upgraded the plugin. In particular, I'm looking for log entries after "Starting Settings Migration Process". Thanks!

@OwensCode
Copy link
Contributor

Just saw the update from @samrocketman. Thanks! Will chase things down from that angle.

@OwensCode OwensCode mentioned this issue Mar 17, 2016
8 tasks
@OwensCode
Copy link
Contributor

I'm not sure where this is being tracked now; maybe it needs to be reopened. Anyway, I think the SlackNotifier$SlackJobProperty is missing its descriptor is misleading and is not the real problem. I suspect that the actual problem is that the configs were not migrated from the 1.8 format to the 2.0 format for some reason. Then when the job runs Jenkins finds the 1.8 job properties and complains because they are no longer part of the form etc. I can replicate this by forcing the migration to be skipped. I need some logs to get a better idea of what's going on; anything after "Starting Settings Migration Process".

@OwensCode
Copy link
Contributor

Unfortunately @psharkey's stack trace still points to the env inject plugin. I'm not sure if the workflow/pipeline plugin depends on it or something, or if that's just what was captured.

In terms of a fix, I haven't seen anything that indicates we can control the order Jenkins loads the plugins, which seems to be the problem with env inject plugin (and possibly others); they seem to be getting loaded before the Slack plugin can migrate the configs. The only idea I have at this stage is to create a script that migrates the settings outside of Jenkins, which admins could run on their servers.

@christek91 I just wanted to clarify on your statement that you can't run Slack 2.0+ alongside those other plugins. That should actually be working fine. It's just the configuration migration when you go from 1.8 to 2.0 that causes problems, and you can potentially make the transition yourself, manually. That's maybe what you meant, but I wanted to clarify.

For developers, don't forget that there's PR #202 waiting for review, which should fix the problem for at least one other plugin.

@christek91
Copy link

Ah yeah I should have been more clear. The issue appears to be with config migration. What @psharkey and I are running into seems to be that the Slack plugin configs aren't migrated for jobs that use the Pipeline/Workflow plugin. So even if you do upgrade in the way you've laid out (temporarily disabling envinject so that the config values can be migrated to their new format), any workflow jobs you have will still have SlackJobProperty elements in their config.xmls. This then causes envinject to choke on these configs when its re-enabled.

So it looks like the config migration isn't happening for workflow/pipeline plugin jobs. Removing the elements from these configs will solve this as @psharkey mentioned, as does changing the elements by hand but that's certainly not ideal. Ideally the migration would be automatic like it is for other jobs.

I understand that the envinject issue isn't in the domain of this plugin and that's fine. Temporarily disabling envinject is easy enough. But this workaround only works if all configs migrate properly, which doesn't appear to be the case in 2.0.1 . I can open another issue for the failing config migration in workflow jobs if you'd like.

@OwensCode
Copy link
Contributor

A quick update that I've taken a quick look at the Pipeline issue and can see the errors. If I upgrade to a build from PR #202 I get a little more info in my logs, which will help me dig into a fix:

Starting Settings Migration Process
Skipping job "Test_Pipeline" with type org.jenkinsci.plugins.workflow.job.WorkflowJob

Just to clarify to make sure I'm not missing something, @christek91, you weren't sending notifications from Pipeline jobs prior to the update, right? ... because slackSend was only added in 2.0.0? It's just that these jobs start crashing after the update.

@christek91
Copy link

You're correct the jobs weren't actually sending anything using slacksend from within workflow itself. There is config data on the job level for workflow jobs (Slack Settings in the UI), which is what is causing things to choke. I'm not sure if they actually were used at all prior to the addition of slacksend, but there are still SlackJobProperty values in the jobs' config.xml anyway. According to the log output you just pasted it looks like they're not being migrated, and that's what's causing the issue w/ envinject to persist.

@OwensCode
Copy link
Contributor

Thanks. Yes, they are not being migrated. The log entry is from the branch for my PR, but it's basically the same issue in the released code. I am working on a fix that I'll add to my PR, since nobody has looked at it yet, and I want to refactor a little to avoid getting more complex. I don't think the Slack job properties are being used at all in these jobs, so the migration will just remove that section from the config.

@OwensCode
Copy link
Contributor

PR #202 has been updated with fixes for pipeline projects. If anyone has the ability to test it, please do so and let me know of any issues. Thanks.

@ElaineRichards
Copy link

ElaineRichards commented May 13, 2016

I wisely created a new Jenkins master with 2.0, rather than install it atop my current Jenkins server (which is happily running jobs in a charming, yet retro manner) I re-created all of my jobs on the new server. It was harmless because it's not running the Agent servers, so any jobs would just stack up and not run. When I restarted Jenkins 2.0, it was unable to come up due to the Slack error. Once I removed all of the jobs that use the Slack plugin, the server came up normally. I checked and the Slack plugin that was installed is already at the most current release.

hudson.util.HudsonFailedToLoad: java.lang.AssertionError: class jenkins.plugins.slack.SlackNotifier$SlackJobProperty is missing its descriptor
at hudson.WebAppMain$3.run(WebAppMain.java:234)
Caused by: java.lang.AssertionError: class jenkins.plugins.slack.SlackNotifier$SlackJobProperty is missing its descriptor
at jenkins.model.Jenkins.getDescriptorOrDie(Jenkins.java:1314)
at hudson.model.JobProperty.getDescriptor(JobProperty.java:105)
at hudson.model.JobProperty.getDescriptor(JobProperty.java:79)
at hudson.model.Descriptor.toMap(Descriptor.java:986)
at hudson.model.Job.getProperties(Job.java:558)
at org.jenkinsci.plugins.envinject.migration.EnvInjectMigrationListener.onLoaded(EnvInjectMigrationListener.java:45)
at jenkins.model.Jenkins.(Jenkins.java:914)
at hudson.model.Hudson.(Hudson.java:85)
at hudson.model.Hudson.(Hudson.java:81)
at hudson.WebAppMain$3.run(WebAppMain.java:225)

I'll continue to tinker with this.

It bothers me that the plugin entirely prevented Jenkins from being accessible, rather than just borking individual jobs.

Just another datapoint.

tl;dr - set up new J2.0 server. Migrated old jobs to it. Server would not start. Removed jobs that use Slack. Server started.

--Edit to add. The old configuration on the "Manage Jenkins" page is different than the one on 2.0. The 2.0 configuration wants "Outgoing Webhook Token" and "Outgoing Webhook URL Endpoint" Clicking around to find out what this is takes me to the plugin documentation page, which does not at all document these settings. Now I get to ask Mister Google what an Outgoing Webhook Token and an Outgoing Webhook URL Endpoint are. Please update your documentation, at the very least.

@samrocketman
Copy link
Member

samrocketman commented May 15, 2016

@ElaineRichards: Re: What are outgoing webhooks?

https://api.slack.com/outgoing-webhooks

From my understanding, Slack has a new feature in which slack can notify Jenkins of an event (kind of like how GitHub can notify Jenkins of open pull requests or reference updates). The "outgoing" webhook is referring to slack sending "out" data (and not your Jenkins). I feel this is poorly worded because in reality it is slack communicating inbound to your Jenkins server.

If you, like me, firewall Jenkins far from the internet as possible then you have no need for Slack "outgoing" webhooks. In that case, I wrote scripts to disable it (see issue #191 for details).

@OwensCode
Copy link
Contributor

@ElaineRichards: thanks for your comments (the stack trace in particular), and well done on trying out the upgrade on a separate server first. If you take a look at my comment from Mar 24th (#188 (comment)) there is a description of the issue with the EnvInject plugin (which you appear to be using) and a potential workaround. The workaround apparently doesn't work if you are using the pipeline/workflow plugin as well, but I have an open PR #202 that should fix those issues, and it would be awesome if we can get some more testing and feedback on the fixes.

@ElaineRichards
Copy link

Thank you @OwensCode and @samrocketman for your responses. I very much appreciate both of you taking the time to look at this issue and provide responses.

I did do a little muppet flailing due to Documentation Fuzziness and cut and pasted the URL that our slack messages show up in and it and Jenkins not only booted up correctly, but it also started sending messages to Slack.

@wimdeblauwe
Copy link

wimdeblauwe commented May 30, 2016

I have a freshly installed Jenkins 2.7 with the slack plugin version 2.0.1 and I also have this problem (The build config is generated with the job-dsl plugin):

Caused by: java.lang.AssertionError: class jenkins.plugins.slack.SlackNotifier$SlackJobProperty is missing its descriptor
    at jenkins.model.Jenkins.getDescriptorOrDie(Jenkins.java:1301)
    at hudson.model.JobProperty.getDescriptor(JobProperty.java:105)
    at hudson.model.JobProperty.getDescriptor(JobProperty.java:79)
    at hudson.util.DescribableList.get(DescribableList.java:127)
    at hudson.util.DescribableList.rebuild(DescribableList.java:168)
    at hudson.model.Job.doConfigSubmit(Job.java:1219)
    at hudson.model.AbstractProject.doConfigSubmit(AbstractProject.java:795)
    ... 74 more

Any ideas how to work around it?

@wimdeblauwe
Copy link

Never mind my previous comment. I needed to use slackNotifier instead of slackNotifications as is explained here: https://github.com/jenkinsci/job-dsl-plugin/wiki/Migration#migrating-to-147

@ianceicys
Copy link

I am having the same problem with Jenkins ver 2.7.

hudson.util.HudsonFailedToLoad: java.lang.AssertionError: class jenkins.plugins.slack.SlackNotifier$SlackJobProperty is missing its descriptor
at hudson.WebAppMain$3.run(WebAppMain.java:241)
Caused by: java.lang.AssertionError: class jenkins.plugins.slack.SlackNotifier$SlackJobProperty is missing its descriptor
at jenkins.model.Jenkins.getDescriptorOrDie(Jenkins.java:1301)
at hudson.model.JobProperty.getDescriptor(JobProperty.java:105)
at hudson.model.JobProperty.getDescriptor(JobProperty.java:79)
at hudson.model.Descriptor.toMap(Descriptor.java:982)
at hudson.model.Job.getProperties(Job.java:559)
at org.jenkinsci.plugins.envinject.migration.EnvInjectMigrationListener.onLoaded(EnvInjectMigrationListener.java:45)
at jenkins.model.Jenkins.(Jenkins.java:921)
at hudson.model.Hudson.(Hudson.java:85)
at hudson.model.Hudson.(Hudson.java:81)
at hudson.WebAppMain$3.run(WebAppMain.java:227)

http://imgur.com/sAFAdok

I have tried restarting Jenkins but that hasn't fixed the issue. Any ideas how to work around it?

@ashleywxwx
Copy link

ashleywxwx commented May 31, 2016

Not sure if this is any help, but I manually configured the plugin similarly to how @samrocketman has, although I didn't have the same problem having to include false on unused properties. The below has worked for our Jenkins 1.654

The gist of it

Edit: This is more a comment in general, not necessarily directed at @ianceicys

@ianceicys
Copy link

@andrewbell Thanks for the info. Which file do I update with these configuration settings? I'm not very familiar with jenkins configuration settings.

@OwensCode
Copy link
Contributor

@ianceicys It looks like you're having problems with the environment injector plugin. Take a look at #188 (comment) for a possible workaround.

@crummy
Copy link

crummy commented Jun 28, 2016

I encountered a conflict between the environment injector plugin and Slack plugin 2.0.1 (would work with one or the other but not both, with the exception mentioned in this thread). The workaround mentioned above didn't work, but I removed all mentions of SlackJobProperty from my pipeline config.xml's and Jenkins booted OK.

@sfenton7
Copy link

sfenton7 commented Aug 9, 2016

I am seeing the same problem in Jenkins V1.609.18.3. I see the stack trace when trying to save configuration changes on some (but not all) jobs, and the changes are not saved.

javax.servlet.ServletException: java.lang.AssertionError: class jenkins.plugins.slack.SlackNotifier$SlackJobProperty is missing its descriptor

I am disabling the plugin until there is a fix, as I can't have an optional plugin breaking some of the basic functions of Jenkins.

@trecloux
Copy link

For information, we had projects failing without any reference to SlackJobProperty in config.xml files. After investigation, this issue was triggered on Inheritance projects. These projects also have versions.xml.gz file, this file contains older versions of the project configuration and these old configurations were including some slack configuration.
We solved our issue by deleting versions.xml.gz files and reload configuration from disk (we did not need the previous project configurations).

@jlrts
Copy link

jlrts commented Sep 13, 2016

We encountered the same error, and we resolved it this way - it seems removing the Slack config from jobs via the UI does not cut it:
On the Jenkins Server:
cd /var/lib/jenkins/jobs
Then:
find . -maxdepth 2 -type f -name 'config.xml'|xargs grep SlackJobProperty
Results:

user@ec2-live-buildmaster-50:/var/lib/jenkins/jobs$ find . -maxdepth 2 -type f -name 'config.xml'|xargs grep SlackJobProperty
./pipe/config.xml:    <jenkins.plugins.slack.SlackNotifier_-SlackJobProperty plugin="slack@1.8">
./pipe/config.xml:    </jenkins.plugins.slack.SlackNotifier_-SlackJobProperty>

Edit each of these files and remove the <jenkins.plugins.slack.SlackNotifier_-SlackJobProperty> block

Go to the Jenkins Manage screen and click on Reload Configuration from Disk to 'refresh' its state.

@samrocketman
Copy link
Member

I went ahead and updated the main issue to highlight the thread which contains fixes.

@samrocketman
Copy link
Member

Feel free to subscribe to #296 for updates related to Slack Plugin 2.2 release.

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

No branches or pull requests