Giter VIP home page Giter VIP logo

Comments (5)

Ardesco avatar Ardesco commented on September 22, 2024 1

To start off with, the fact you have had no problems running with multiple threads over x period of time does not mean that the plugin is thread safe, it just means you haven't got unlucky yet.

Making the code thread safe is rarely as simple as sticking a synchronised keyword in a few places, all you are doing is forcing the code to queue up multiple requests that will be executed in a single thread (In other words you are blocking the code from running in multiple threads).

To make the plugin thread safe we would need to do the following as a minimum:

  • Check all dependencies are thread safe and change them/get their authors to make them threads safe and update them if they are not.
  • Check all static member variables are using thread safe data types and change them if they are not.
  • To ensure acceptable performance levels you should limit the use of synchronized and instead make the code smarter e.g. if multiple threads want to download a file, one thread should download it and then report to the other threads that it was downloaded successfully, you don't want to end up downloading the same file 5 times in sequence (Or in the case of your PR depending upon which call gets in next we may perform 2 downloads, then an unzip, then another download, then two more unzips, etc, etc).
  • The plugin works with external files that are not part of the JVM, we should really be locking them from an os level before working on them (this would also protect you against two maven runs running in parallel in separate terminals).

It is possible to make the plugin thread safe, but it's going to take time, effort and require lots of testing.

Also please do bear in mind that what you are seeing in your maven console is simply a warning, if everything works fine for you, you can just disregard it; it is a warning after all.

from driver-binary-downloader-maven-plugin.

Ardesco avatar Ardesco commented on September 22, 2024

The plugin is not thread safe. It uses a static download location, and it extracts binaries to a single location, if multiple instances of the plugin try to download/extract at the same time you could end up with corrupted downloads/binaries.

from driver-binary-downloader-maven-plugin.

ManuelB avatar ManuelB commented on September 22, 2024

@Ardesco I reviewed the mentioned parts and added synchronized blocks.

ManuelB@833c0ee

We are already running the plugin for multiple month with mvn -T1C and it works without problems.

Is there anything else that I have to do?

from driver-binary-downloader-maven-plugin.

mpkorstanje avatar mpkorstanje commented on September 22, 2024

This may be worth reviewing: https://cwiki.apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3

from driver-binary-downloader-maven-plugin.

ManuelB avatar ManuelB commented on September 22, 2024

@Ardesco thanks a lot for your description. I think I won't get the time from my employer to do the necessary work. For now I will just ignore the warning.

from driver-binary-downloader-maven-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.