Uploaded image for project: 'Policy Framework'
  1. Policy Framework
  2. POLICY-3929

Race condition in apex-editor model upload


    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • Jakarta Release
    • Guilin Release, Honolulu Release, Istanbul Release, Jakarta Release
    • gui
    • None

      This bug was previously documented in POLICY-2853, but never fixed.

      The code takes in a request parameter and stores it in a global variable:

      public ApexApiResult uploadModel(@QueryParam("userId") final String userid) {
          if (!StringUtils.isBlank(userid)) {
          return processRestCommand(RestCommandType.MODEL, RestCommand.UPLOAD);

      Thus if two users upload at the same time, one userId may overwrite the other.

      An appropriate fix would be to use userId param only for this request if specified, otherwise use the upload-userid command line param specified at apex-editor startup. This will work as ApexFiles.js sets the userId param for each upload request:

      function files_fileUpload() {
          let requestURL = window.restRootURL + "/Model/Upload";
          const userId = new URLSearchParams(window.location.search).get('userId');
          if (userId) {
              requestURL = requestURL + "?userId=" + userId;
          // ...

            danielhanrahan Daniel Hanrahan
            danielhanrahan Daniel Hanrahan
            0 Vote for this issue
            1 Start watching this issue