Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #7601
Closed
Open
Issue created Oct 05, 2020 by Administrator@rootContributor

[BUG] Use of GlobalSettings in gradle-plugin leads to race conditions in Gradle 6.6+

Created by: nhoughto

Description

On the latest version of Gradle 6.6 and latest generator 4.3.1 I am seeing inconsistent generation of outputs, some projects where model generation is disabled, intermittently models appear and the next run they do not appear. I believe this is due to running my multi-module gradle project with a number of openapi generator tasks running at once, the current problem is with ~5 concurrent generations running.

It appears that there is a race condition in the GeneratorTask and the use of a global singleton GlobalSettings:

https://github.com/OpenAPITools/openapi-generator/blob/61b543f03dc546386467c9a7afe8864f6f609ed1/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt#L513

GlobalSettings appears to defend against this via a ThreadLocal map which seems to work in Gradle 6.5, but fail in Gradle 6.6+. I'm not sure whats changed in Gradle land but it seems like any settings configured via GlobalSettings conflict/collide with each other when running concurrently, if I set --max-workers 1 everything works as expected, if workers is > 1 then the problems start.

openapi-generator version

4.3.1

OpenAPI declaration file content or url

n/a

Generation Details

n/a

Steps to reproduce

n/a

Related issues/PRs

None that I can see

Suggest a fix

Not sure, it seems like something in upstream Gradle has changed in the 6.5 -> 6.6 upgrade, I was able to work around it by moving from configuration that ended up in GlobalSettings and re-implemented it in ignore files.

Assignee
Assign to
Time tracking