Search Unity

`Cannot connect to Unity Package Manager local server` when launching multiple Unity at same time

Discussion in 'Package Manager' started by kyubuns, Feb 2, 2021.

  1. kyubuns

    kyubuns

    Joined:
    Aug 6, 2013
    Posts:
    138
    `Cannot connect to Unity Package Manager local server` when launching multiple Unity at same time.

    On my CI server (Windows), I launch four Unity projects at the same time when a GitHub PullRequest comes in. (They refer to different directories, but the same project is cloned.)
    Some of them cause the error `Cannot connect to Unity Package Manager local server`.
    The trouble is, it doesn't happen every time.
    It succeeds after many attempts.
    This phenomenon still occurs in 2019.4 and is still occurring in 2020.2.2f1.
    Does anyone know of any workarounds?

    Full log is here↓.
     
  2. supita_unity

    supita_unity

    Unity Technologies

    Joined:
    Dec 13, 2019
    Posts:
    226
    Hey, sorry to see you are having this issue. I'm not sure what is causing it, but this error
    Server stopped with exit code `101` 
    indicates that there was an unhandled exception during the launch of the Package Manager application. Can you share the upm.log with us when this error happens? For what I see this is not a consistent problem and I'm not sure what could cause this issue randomly.

    If you are able to catch this problem in one of your CI machines, you could troubleshoot it by launching the Unity Package Manager application, that is located in
    <path-to-unity-installation-dir>\Data\Resources\PackageManager\Server\UnityPackageManager.exe

    You could take a look to this post maybe there is some information there that is useful in your quest.
     
  3. kyubuns

    kyubuns

    Joined:
    Aug 6, 2013
    Posts:
    138
    I have collected multiple logs.
    The method of launching UnityPackageManager.exe seems to be useful, but it is difficult to manage the port number because we are creating CI across multiple Unity versions/projects.


    + cat C:/Users/Administrator/AppData/Local/Unity/Editor/upm.log
    [2021-02-11T03:03:18.415Z][INFO] Creating server instance
    [2021-02-11T03:03:18.481Z][INFO] Starting Server
    [2021-02-11T03:03:18.507Z][ERROR] Failed to start server: Error: listen EACCES: permission denied 127.0.0.1:49840



    + cat C:/Users/Administrator/AppData/Local/Unity/Editor/upm.log
    [2021-02-11T03:02:37.563Z][INFO] Creating server instance
    [2021-02-11T03:02:37.645Z][INFO] Starting Server
    [2021-02-11T03:02:37.671Z][ERROR] Failed to start server: Error: listen EACCES: permission denied 127.0.0.1:49804



    + cat C:/Users/Administrator/AppData/Local/Unity/Editor/upm.log
    [2021-02-11T03:01:15.975Z][INFO] Creating server instance
    [2021-02-11T03:01:16.158Z][INFO] Starting Server
    [2021-02-11T03:01:16.185Z][INFO] Server started on port [59644]
    [2021-02-11T03:01:16.505Z][INFO] Health Request received
    [2021-02-11T03:01:20.190Z][INFO] Resolving dependencies using SAT solver
    [2021-02-11T03:01:46.475Z][ERROR] [Unity Package Manager (Upm)]
    Parent process [16876] was terminated
     
  4. supita_unity

    supita_unity

    Unity Technologies

    Joined:
    Dec 13, 2019
    Posts:
    226
    @kyubuns Thanks a lot for the logs provided. What OS version are you using in your CI machines?

    Unity should launch the Package Manager application in a port that it previously checked was able to use, this error indicates that it has permission issues, I'm not sure how that's even possible. Maybe the OS is detecting the socket was opened and immediately closed, and then the same application is trying to access the same port again, deeming it as suspicious and denying access to the port, the error you are getting. Maybe having several Unity instances doing this at the same time is triggering some safeguard on your CI machine? It could be that there is some firewall/antivirus/security configuration that could be causing this problem. I'm saying this because the error you are getting is not a port in use one (EADDRINUSE).

    Honestly the best workaround would be get a range of ports in those machines dedicated to Unity and launch manually Unity Package Manager and then Unity with the free port.
     
    Last edited: Feb 17, 2021
  5. kyubuns

    kyubuns

    Joined:
    Aug 6, 2013
    Posts:
    138
    Thanks for your reply.
    I’m using Windows Server 2019 on AWS EC2.

    > Honestly the best workaround would be get a range of ports in those machines dedicated to Unity and launch manually Unity Package Manager and then Unity with the free port.
    I understand. I will try to this.

    Thank you very much.