"MapdlConnectionError" when runnung PyMAPDL

Options
Samukham
Samukham Member Posts: 37
First Anniversary First Comment Name Dropper
edited February 1 in General Language Questions

Hi Team,
I have a PyMAPDL script. When I run the script I get frequently the following error:

"
Error using mapdl_grpc>_multi_connect
Python Error: MapdlConnectionError: Unable to connect to MAPDL gRPC instance at 127.0.0.1:50053.
Reached either maximum amount of connection attempts (5) or timeout (45 s).The MAPDL process seems to be alive (PID: 24408) but PyMAPDL cannot connect to
it.

Error in mapdl_grpc>init (line 387)

Error in mapdl_grpc>init (line 395)

Error in launcher>launch_mapdl (line 1972)

Error in launcher>launch_mapdl (line 1993)

Error in ModalSensitivity>launch_mapdl (line 275)

Error in ModalSensitivity>perform_modal_sensitivity (line 78)
"

Immediately if I run the script again it runs smoothly without any issues. This error I get often like appx. once every 3-4 runs.

Please guide us in resolving the issue.

Comments

  • Samukham
    Samukham Member Posts: 37
    First Anniversary First Comment Name Dropper
    Options

    Any suggestion on this? As I have posted this long back and didn't receive any response yet!

  • German Martinez
    German Martinez Member, Employee Posts: 6
    First Anniversary Name Dropper First Comment Ansys Employee
    Options

    Hi

    It seems to me that the launcher is taking longer to start the MAPDL instance.

    I would try to increase start_timeout:

    mapdl = launch_mapdl(start_timeout=80)
    
  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 312
    First Anniversary First Comment 5 Likes Ansys Employee
    edited March 8
    Options

    @German Martinez , I am getting this error as well as sometimes the connection is made, but then it has a connection error like this after connection. This seems somewhat random in nature.

    I am also trying to run PyMAPDL on an async thread with the threading module. Any ideas?
    It also seems odd that the connection to MAPDL would take longer than 45s. Why might this be?

    ansys.mapdl.core.errors.MapdlExitedError: MAPDL server connection terminated

  • Samukham
    Samukham Member Posts: 37
    First Anniversary First Comment Name Dropper
    Options

    @German Martinez, Also I tried with launch_mapdl(start_timeout=60) but did not make any difference. The only difference it makes is now it throws an error with much delay now!

  • Mike.Thompson
    Mike.Thompson Member, Employee Posts: 312
    First Anniversary First Comment 5 Likes Ansys Employee
    Options

    @Pernelle Marone-Hitz , do you have any idea on this? I am still having this issue seemingly randomly. it typically connects either very quickly, or not at all. Adding time to the time out I expect will have the same outcome as seen by other users to only delay the time I need to wait to get the error.

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 827
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Options

    @Mike.Thompson This should be reported as a bug in the PyMAPDL repo. @German Martinez could you have a look at this please? Many thanks