Create two duplicate group when call create group api with same group name at the same time?

Template for a good bug report, formatted with Markdown:

  • versions used: SonarQube 7.9
  • error observed:
    when call create group api with same group name at the same time,

    will create duplicate group
  • steps to reproduce
  • potential workaround
  1. not add db constraint on table groups columns name
    schema: https://github.com/SonarSource/sonarqube/blob/4b24dd9c4060ef27950440249b1a279b02e9405b/server/sonar-db-dao/src/schema/schema-sq.ddl#L327
    history reason: (MySQL cannot create a unique index on a UTF-8 VARCHAR larger than 255 characters on InnoDB ) https://github.com/SonarSource/sonarqube/blob/4fc4a5853354a00e80f1e27556385e4338b57cd0/server/sonar-webserver-webapi/src/main/java/org/sonar/server/usergroups/ws/GroupWsSupport.java#L136
  2. table groups column name max length limit in code is 255, but in db limit is 500
    in code: https://github.com/SonarSource/sonarqube/blob/3f6f5496277c76c2498fd245a112931d19830497/sonar-plugin-api/src/main/java/org/sonar/api/user/UserGroupValidation.java#L29
    in db: https://github.com/SonarSource/sonarqube/blob/4b24dd9c4060ef27950440249b1a279b02e9405b/server/sonar-db-dao/src/schema/schema-sq.ddl#L329

can we migrate table groups change column name limit max length 255, and add uniq constraint in next version?

thanks you

Hi,

Thanks for this report. Would you mind clarifying how you discovered this? Was it a double-tap in the interface, or via deliberately-duplicated manual web service calls? (Or something else?)

 
Thx,
Ann

I has a web service which is used to monitor some events and automatically create and update project and group and user by sonarqube api。When the event occurs twice in a very short time, create groups of users interface will be called twice, but both the success. expect Failed at last time。

1 Like

Hello @ningshen,

Indeed it should be handled better.

Thanks for raising that issue, ticket created: SONAR-13757

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.