Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-76269

Users migration failing since LTS 2.528.1 upgrade causing new API tokens to disappear

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None
    • Visible on ci.jenkins.io (Jenkins LTS 2.528.1 on a Linux Machine running in the official JDK21 Docker image)

      Since we upgraded ci.jenkins.io to the latest LTS 2.528.1 (https://www.jenkins.io/changelog-stable/#v2.528.1), we have users which API tokens disappear in favor of an old one.

      We can see the behavior in https://github.com/jenkins-infra/helpdesk/issues/4840#issuecomment-3411783319 (see screenshot) and in https://github.com/jenkins-infra/helpdesk/issues/4852.

      The user "releasebot" in the links above has its API tokens disappearing on each controller restart which ends in referencing the old token from the screenshot marked as "Never used" and "More then 4 years old".

      On the controller startup logs, we can correlate this to warning messages about user failed to migrate, like the one above (note: I've replaced the name of the user by `xxx` but kept the string suffix when there is one to be precise):

      Oct 29 06:54:12 ip-10-0-0-177 docker-jenkins[1406]: 2025-10-29 06:54:12.054+0000 [id=60]        WARNING        hudson.model.UserIdMapper#migrate: failed to migrate /var/jenkins_home/users/xxx_604831278167065574
      Oct 29 06:54:12 ip-10-0-0-177 docker-jenkins[1406]: java.nio.file.DirectoryNotEmptyException: /var/jenkins_home/users/xxx_89e70a4cf631ad63ed0d43d9960822303a1faf2e3d122afd74e5b1654b6a40b3
      Oct 29 06:54:12 ip-10-0-0-177 docker-jenkins[1406]:         at java.base/sun.nio.fs.UnixFileSystem.move(Unknown Source)
      Oct 29 06:54:12 ip-10-0-0-177 docker-jenkins[1406]:         at java.base/sun.nio.fs.UnixFileSystemProvider.move(Unknown Source)
      Oct 29 06:54:12 ip-10-0-0-177 docker-jenkins[1406]:         at java.base/java.nio.file.Files.move(Unknown Source)
      Oct 29 06:54:12 ip-10-0-0-177 docker-jenkins[1406]:         at hudson.model.UserIdMapper.migrate(UserIdMapper.java:104)
      Oct 29 06:54:12 ip-10-0-0-177 docker-jenkins[1406]:         at hudson.model.User$AllUsers.migrateUserIdMapper(User.java:1108)
      Oct 29 06:54:12 ip-10-0-0-177 docker-jenkins[1406]:         at hudson.model.User.loadFromUserConfigFile(User.java:239)
      Oct 29 06:54:12 ip-10-0-0-177 docker-jenkins[1406]:         at hudson.model.User.load(User.java:208)
      Oct 29 06:54:12 ip-10-0-0-177 docker-jenkins[1406]:         at hudson.model.User.<init>(User.java:198)≥
      

      For each failed user, we can find a corresponding message in the Admin UI about old data. In the "Manage Old Data":

      hudson.model.User	xxx	CannotResolveClassException: io.jenkins.blueocean.autofavorite.user.FavoritingUserProperty, CannotResolveClassException: hudson.plugins.favorite.user.FavoriteUserProperty
      

      I've taken a backup of the users directory on ci.jenkins.io and removed all the users with the name following the pattern `release*`. Then I reloaded the controller from disk and re logged-in as `releasebot`: I can't reproduce the problem for this user anymore.

      The user backup can be used to provide further debug information if need be.

      Could it be related to https://github.com/jenkinsci/jenkins/pull/10926?

            Unassigned Unassigned
            dduportal Damien Duportal
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: