Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-8556

BB's implementation of SAL scheduling API has serializability requirement that's not in the API contract

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Low Low
    • None
    • None
    • Plugin Development
    • None

      We found that a cross-product plugin using the PluginScheduler API, which worked in all other products, failed in Bitbucket Server with the following exception:

      java.lang.IllegalArgumentException: PluginScheduler requires job data to be Serializable. key={}, valueClass={}
      	at com.atlassian.stash.internal.sal.scheduling.PluginSchedulerAdapter.validateJobData(PluginSchedulerAdapter.java:101) ~[bitbucket-platform-4.0.1.jar:na]
      	at com.atlassian.stash.internal.sal.scheduling.PluginSchedulerAdapter.scheduleJob(PluginSchedulerAdapter.java:47) ~[bitbucket-platform-4.0.1.jar:na]
      

      However, according to the API documentation linked above, it's not true that "PluginScheduler requires job data to be Serializable". The documentation says that the job data map "will always be the same instance that is given to the job when it executes"; if it's serialized and then deserialized, it would not be the same instance. So this seems to be an undocumented deviation from the SAL API contract.

      We have worked around this by using atlassian-scheduler-compat for code that needs to work in both Bitbucket and other products, but this is not ideal.

          Form Name

            [BSERV-8556] BB's implementation of SAL scheduling API has serializability requirement that's not in the API contract

            I understand, but for the record I disagree with your won't-fix rationale. "Deprecated" is not and should not be the same as "this doesn't work correctly even now".

            Also, your statement about "the correct way to schedule a job" is unhelpful to developers who need to maintain compatibility with products and product versions that don't support atlassian-scheduler. That's why atlassian-scheduler-compat exists in the first place. I realize there aren't a lot of such cases, but UPM for instance is one of them.

            Eli Bishop (Inactive) added a comment - I understand, but for the record I disagree with your won't-fix rationale. "Deprecated" is not and should not be the same as "this doesn't work correctly even now ". Also, your statement about "the correct way to schedule a job" is unhelpful to developers who need to maintain compatibility with products and product versions that don't support atlassian-scheduler . That's why atlassian-scheduler-compat exists in the first place. I realize there aren't a lot of such cases, but UPM for instance is one of them.

            Nick added a comment -

            As per the javadoc for PluginScheduler, this is deprecated

            Deprecated
            in 3.0 for removal in 4.0.
            

            The correct way to schedule a job is in fact to use https://bitbucket.org/atlassian/atlassian-scheduler , as even -compat might be going away sometime soon.

            Therefore, closing this as Wont Fix.

            Nick added a comment - As per the javadoc for PluginScheduler, this is deprecated Deprecated in 3.0 for removal in 4.0. The correct way to schedule a job is in fact to use https://bitbucket.org/atlassian/atlassian-scheduler , as even -compat might be going away sometime soon. Therefore, closing this as Wont Fix.

              Unassigned Unassigned
              ebishop Eli Bishop (Inactive)
              Affected customers:
              1 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: