History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CIB-1944
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: 3 3
Assignee: jason
Reporter: Chuck Batson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Pulse

Error hiding 'scm trigger' from a project template

Created: 23/Apr/09 10:40 PM   Updated: 12/May/09 12:03 PM
Component/s: None
Affects Version/s: 2.0.23
Fix Version/s: 2.1.4, 2.0.29

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: Windows XP


 Description  « Hide
I have a project template hierarchy. A particular template inherits a trigger 'scm trigger' from its parent. The trigger has been hidden in the child template. It is desired to restore the hidden trigger in the child template, however attempts to do so result in this error message:

com.zutubi.pulse.master.scheduling.SchedulingException: A trigger with name scm trigger and group project:2949120 has already been scheduled.

The trigger is not restored.

This error happens even when the recipe queue is paused and there are no active or queued builds or recipes.

 All   Comments   Work Log   Change History      Sort Order:
jason - 24/Apr/09 05:00 AM
Hi Chuck,

Thanks for the report. I tried a simple test here with a layout like:

template - defines scm trigger
  + child template
     + concrete project 1
     + concrete project 2

I hid the trigger in child template then restored it and it worked OK. I also tried to add an scm trigger to one of the concrete projects while the child template was still hiding its trigger, but Pulse (correctly) prevented me from doing so. Finally I tried pausing the trigger in a concrete project before hiding/restoring it, but still didn't see the problem.

Obviously I am missing the sequence of operations required to reproduce the behavior (which is certainly a bug). Do you remember anything else significant in the history of this trigger/these projects that may help?

To fix the problem, you will probably need to shut down Pulse and delete the relevant trigger from your Pulse database. The trigger can be deleted using the SQL statement:

delete from LOCAL_TRIGGER where TRIGGER_NAME = 'scm trigger' and TRIGGER_GROUP = 'project:2949120'

I strongly recommend backing up your database first just in case.

Chuck Batson - 24/Apr/09 11:46 AM
Thank you for taking a look Jason.

I attempted to reproduce the issue by creating some new templates and projects, but in doing so somehow the original project has gotten corrupted, as I now receive errors like:

triggers
Triggers allow you to specify when builds will be run for this project.
Failed to render form. Unexpected class java.lang.NullPointerException: null

And:

The following projects have invalid configuration, and cannot be used for building or reporting until rectified:

I will back up the database and issue the command you recommend. I will probably also delete the errant project and template and try again.

If it will help you diagnose the issue, I can send you a copy of the database backup.

Thank you,

Chuck

Chuck Batson - 24/Apr/09 12:20 PM
The server had been using the embedded database. Presumably there is no way to issue commands to the embedded database. I will attempt to migrate to a MySQL database and then proceed.

Chuck Batson - 24/Apr/09 01:15 PM
I was able to successfully migrate the database. Your 'delete' command deleted 1 row from the database. However, the server will no longer start. Here is the error I receive:

java.lang.NullPointerException
at com.zutubi.pulse.master.tove.config.project.triggers.BuildCompletedTriggerConfiguration.populateDataMap(BuildCompletedTriggerConfiguration.java:121)
at com.zutubi.pulse.master.tove.config.project.triggers.BuildCompletedTriggerConfiguration.newTrigger(BuildCompletedTriggerConfiguration.java:109)
at com.zutubi.pulse.master.tove.config.project.triggers.TriggerManager.createState(TriggerManager.java:75)
at com.zutubi.pulse.master.tove.config.project.triggers.TriggerManager.createState(TriggerManager.java:19)
at com.zutubi.tove.config.ConfigurationStateManager$1.execute(ConfigurationStateManager.java:66)
at com.zutubi.tove.transaction.TransactionManager.runInTransaction(TransactionManager.java:254)
at com.zutubi.tove.config.ConfigurationStateManager.createAndAssignState(ConfigurationStateManager.java:60)
at com.zutubi.tove.config.DefaultConfigurationProvider.ensureExternalStateIsInSyncWithConfiguration(DefaultConfigurationProvider.java:75)
at com.zutubi.tove.config.DefaultConfigurationProvider.init(DefaultConfigurationProvider.java:53)
at com.zutubi.pulse.master.bootstrap.DefaultSetupManager.requestSetupComplete(DefaultSetupManager.java:526)
at com.zutubi.pulse.master.bootstrap.DefaultSetupManager$3.run(DefaultSetupManager.java:499)
at com.zutubi.pulse.master.security.AcegiUtils.runAsUser(AcegiUtils.java:69)
at com.zutubi.pulse.master.security.AcegiUtils.runAsSystem(AcegiUtils.java:86)
at com.zutubi.pulse.master.bootstrap.DefaultSetupManager.requestUpgradeComplete(DefaultSetupManager.java:476)
at com.zutubi.pulse.master.bootstrap.DefaultSetupManager.requestLicenseComplete(DefaultSetupManager.java:431)
at com.zutubi.pulse.master.bootstrap.DefaultSetupManager.requestRestoreComplete(DefaultSetupManager.java:391)
at com.zutubi.pulse.master.bootstrap.DefaultSetupManager.handleRestorationProcess(DefaultSetupManager.java:723)
at com.zutubi.pulse.master.bootstrap.DefaultSetupManager.requestDbComplete(DefaultSetupManager.java:306)
at com.zutubi.pulse.master.bootstrap.DefaultSetupManager.handleDbMigration(DefaultSetupManager.java:262)
at com.zutubi.pulse.master.bootstrap.DefaultSetupManager.handleDbSetup(DefaultSetupManager.java:245)
at com.zutubi.pulse.master.bootstrap.DefaultSetupManager.requestDataComplete(DefaultSetupManager.java:207)
at com.zutubi.pulse.master.bootstrap.DefaultSetupManager.startSetupWorkflow(DefaultSetupManager.java:131)
at com.zutubi.pulse.master.bootstrap.tasks.ProcessSetupStartupTask.run(ProcessSetupStartupTask.java:60)
at com.zutubi.pulse.master.security.PulseThreadFactory$DelegatingRunnable.run(PulseThreadFactory.java:33)
at java.lang.Thread.run(Unknown Source)

I have also tried deleting all triggers named 'scm trigger' which doesn't help.

I think I will go with a fresh setup now. I didn't have many projects so it shouldn't be too painful.

jason - 26/Apr/09 12:46 PM
Hi Chuck,

OK, it looks like just deleting that row was insufficient as the config system (outside the database) still wanted to recreate it. The odd thing, though, is that it is trying to recreate a build completed trigger, not an SCM trigger. I'm not sure why that would be, unless the wrong trigger was deleted, or the config is really out of whack somehow.

If you have not started again, I would be happy to take a look at your data and try to restore it to a working state. Just let me know and I can give instructions to upload your config and database.

Chuck Batson - 26/Apr/09 03:46 PM
Hello Jason, thanks for your continued help. I managed to reproduce the issue consistently. Here are the steps:

1. Start a fresh 2.0.22 server (Windows XP service), using the embedded database.
2. Under administration | projects:
3. Add a new template to global project template, call it 'template1'
4. Add a new template to 'template1', call it 'subtemplate1'
5. Add a new project to 'subtemplate1', call it 'subproject1'
6. Add a new template to 'template1', call it 'subtemplate2'
7. Configure 'subtemplate2' to add a 'build completed' trigger for 'subproject1' ('success' state), calling it 'build'
8. Add a new template to 'subtemplate2', call it 'subsubtemplate1'
9. Configure 'subsubtemplate1' to add a 'cron trigger' named 'nightly' with 'cron string' = '0 0 1 * * ?'
10. Add a new project to 'subsubtemplate1', call it 'subsubproject1'
11. Examine the project 'subsubproject1'; note the triggers are correct
12. Configure 'subsubtemplate1' to hide the triggers 'scm trigger' and 'build'
13. Add a new project to 'subsubtemplate1', call it 'subsubproject2'
14. Examine the project 'subsubproject2'; note the trigger 'scm trigger' appears as 'overridden'
15. Configure 'subsubtemplate1' to attempt to restore the 'scm trigger'
16. You will receive the error 'java.lang.NullPointerException', or 'com.zutubi.pulse.master.scheduling.SchedulingException: A trigger with name scm trigger and group project:98306 has already been scheduled.' (if the recipe queue is not empty?)
17. Further project configuration browsing (i.e., trying to look at the triggers) may result in 'Invalid transaction status: rollingback' errors.
18. Shortly thereafter the server may become unusable (unresponsive to http requests).

Hope that helps.

Chuck

jason - 28/Apr/09 08:11 AM
Wow, thanks for such a detailed follow-up! I'll give this a try soon and hopefully will be able to resolve the underlying issue.

jason - 30/Apr/09 03:45 PM
Thanks to the extra details I was able to find the root of this problem: the project wizard adds a default scm trigger to a project if its parent does not have one which it will inherit. Unfortunately, if an ancestor project has the trigger and then it is hidden, the wizard will still add it. This violates an invariant of the templating system: you should not be able to override a hidden path. So there are two problems: the wizard needs to recognise not to try adding the trigger in this case, and the underlying config system should reject it to preserve consistency.

Fixed in change 5853.

jason - 08/May/09 01:19 PM
Merged to trunk in change 5874.

Chuck Batson - 12/May/09 11:38 AM
I have verified that this is fixed in version 2.0.29. Thank you!

Chuck

jason - 12/May/09 12:03 PM
No problem Chuck, thanks for following up.