You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Guillaume Nodet (Jira)" <ji...@apache.org> on 2021/05/04 15:17:00 UTC

[jira] [Updated] (MRESOLVER-179) NamedLocks should be acquired in an ordered way

     [ https://issues.apache.org/jira/browse/MRESOLVER-179?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet updated MRESOLVER-179:
--------------------------------------
    Description: 
[~michael-o] [~cstamas] I was about to start porting my simple SyncContext to maven-resolver and start working on a PR when I saw that the API has changed a lot with the introduction of NamedLocks.

I see some design problems in the new API. Multiple locks are now acquired in sequence instead of using a coarse grained call.  This can lead to deadlocks as one client could try to lock {{a}} then {{b}} while another one could try to lock {{b}} then {{a}}, leading to a possible deadlock. 

It should be just a matter to order them inside the {{AdaptedLockSyncContext.acquire}} call which is the only location where the API is used.

I'll provide a PR asap.

  was:
[~michal-o] [~cstamas] I was about to start porting my simple SyncContext to maven-resolver and start working on a PR when I saw that the API has changed a lot with the introduction of NamedLocks.

I see some design problems in the new API. Multiple locks are now acquired in sequence instead of using a coarse grained call.  This can lead to deadlocks as one client could try to lock {{a}} then {{b}} while another one could try to lock {{b}} then {{a}}, leading to a possible deadlock. 

It should be just a matter to order them inside the {{AdaptedLockSyncContext.acquire}} call which is the only location where the API is used.

I'll provide a PR asap.


> NamedLocks should be acquired in an ordered way
> -----------------------------------------------
>
>                 Key: MRESOLVER-179
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-179
>             Project: Maven Resolver
>          Issue Type: Bug
>            Reporter: Guillaume Nodet
>            Priority: Major
>
> [~michael-o] [~cstamas] I was about to start porting my simple SyncContext to maven-resolver and start working on a PR when I saw that the API has changed a lot with the introduction of NamedLocks.
> I see some design problems in the new API. Multiple locks are now acquired in sequence instead of using a coarse grained call.  This can lead to deadlocks as one client could try to lock {{a}} then {{b}} while another one could try to lock {{b}} then {{a}}, leading to a possible deadlock. 
> It should be just a matter to order them inside the {{AdaptedLockSyncContext.acquire}} call which is the only location where the API is used.
> I'll provide a PR asap.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)