"MapdlConnectionError" when runnung PyMAPDL

Samukham
Samukham Member Posts: 41
10 Comments First Anniversary 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: 41
    10 Comments First Anniversary Name Dropper
    **

    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
    ✭✭✭

    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: 342
    25 Answers 100 Comments 25 Likes First Anniversary
    ✭✭✭✭
    edited March 8

    @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: 41
    10 Comments First Anniversary Name Dropper
    **

    @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: 342
    25 Answers 100 Comments 25 Likes First Anniversary
    ✭✭✭✭

    @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: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭

    @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