xcfem / xc

finite element analysis package for civil engineering structures.
http://www.xcengineering.xyz/html_files/software.html
GNU General Public License v3.0
262 stars 54 forks source link

'GDK_IS_DISPLAY (display)' failed and Windows Subsystem for Linux. #101

Closed lcpt closed 2 years ago

lcpt commented 2 years ago

@mihdicaballero has found this bug running the XC verification tests on a WSL machine running Ubuntu 20.04. The results he obtained are here.

Some tests complain about the connection to the XServer: Unable to init server: Could not connect: Connection refused and then they show the following message gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed. The test itself works as expected and returns OK.

Apparently, the problem is related with the use of Matplotlib module. I've removed or commented out the lines that import this module because it's not needed unless you're debugging the code.

I've no access to an WSL machine, so I can't check if that solution works. @ebrahimraeyat, @mihdicaballero could you pull the modified verification tests and check if this workaround works?

ebrahimraeyat commented 2 years ago

Thanks @lcpt. For me errors still are there:

test test_earth_pressure.py: ok.
test test_earth_pressure_sloped_wall.py: ok.
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused

(test_surf_unif_load_distributed.py:225): Gdk-CRITICAL **: 15:03:57.995: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
test test_surf_unif_load_distributed.py: ok.
   Earthquake action tests.
test mononobe_okabe_test_01.py: ok.
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused

(test_NCSP_01.py:234): Gdk-CRITICAL **: 15:04:00.586: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed

.....
lcpt commented 2 years ago

I've modified run_verif.sh trying to avoid Matplotlib complaints by adding this:

if [ -n "$MPLBACKEND" ]; then
   echo "$JAUNE" "MPLBACKEND already set as: $MPLBACKEND" "$NORMAL"
else
   echo "$BLEU" "Setting MPLBACKEND to avoid Matplotlib complaints." "$NORMAL"
   MPLBACKEND=Agg
   export MPLBACKEND
fi

Maybe this works.

ebrahimraeyat commented 2 years ago

Thanks @lcpt . It removes those errors, but some new errors, maybe new issue needed:

test test_element_axis_01.py: ok.
Traceback (most recent call last):
  File "tests/elements/crd_transf/test_element_axis_02.py", line 53, in <module>
    fiberSectionRepr.setGeomNamed(quadFibersGeom.name)
AttributeError: 'GeomSection' object has no attribute 'name'
.
.
.
     Force beam-column 3D tests.
Traceback (most recent call last):
  File "tests/elements/beam_column/test_force_beam_column_3d_01.py", line 59, in <module>
    fiberSectionRepr.setGeomNamed(testQuadRegion.name) # We assign the geometry (regions and rebars)
AttributeError: 'GeomSection' object has no attribute 'name'
Traceback (most recent call last):
  File "tests/elements/beam_column/test_force_beam_column_3d_02.py", line 63, in <module>
    fiberSectionRepr.setGeomNamed(testQuadRegion.name)
AttributeError: 'GeomSection' object has no attribute 'name'
Traceback (most recent call last):
  File "tests/elements/beam_column/test_force_beam_column_3d_03.py", line 64, in <module>
    fiberSectionRepr.setGeomNamed(testQuadRegion.name)
AttributeError: 'GeomSection' object has no attribute 'name'
Traceback (most recent call last):
  File "tests/elements/beam_column/test_force_beam_column_3d_04.py", line 67, in <module>
    fiberSectionRepr.setGeomNamed(testQuadRegion.name)
AttributeError: 'GeomSection' object has no attribute 'name'
Traceback (most recent call last):

and more similar errors. thanks.

lcpt commented 2 years ago

That's strange. It's always the same error, but it has nothing to do with the matplotlib issue.

In my computer, it works perfectly fine ... And before this change, the examples worked fine for you as well, isn't it?

It's quite strange. Have you changed anything else?

mihdicaballero commented 2 years ago

Hi! @lcpt I just run again the verification tests, and it almost was Ok in everything. I only had some errors with gmsh:

image

Thanks :)

lcpt commented 2 years ago

Different versions of GMSH create slightly different meshes with different number of nodes. This is probably the cause of this error (the mesh is perfectly fine, but XC expects a different number of nodes). Could you open a new issue for this problem?, in the interim I'll take a look on how to solve it.

lcpt commented 2 years ago

@ebrahimraeyat if the problem with the name of GeomSection objects persists, I think it's better to open a new issue.

ebrahimraeyat commented 2 years ago

@ebrahimraeyat if the problem with the name of GeomSection objects persists, I think it's better to open a new issue.

Thanks @lcpt. I decided to compile xc again and if errors still exist, I will open new issue about it. Thank you so much.

lcpt commented 2 years ago

I think this will probably fix the problem.

I'll close this issue. You can open a new one as needed.