New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angelscript not working correctly on Linux x86_64 #174

Closed
tritonas00 opened this Issue May 9, 2015 · 34 comments

Comments

Projects
None yet
8 participants
@tritonas00
Collaborator

tritonas00 commented May 9, 2015

Loading this server: cifpo modded ror.ezzg.be:14005 nHelens (http://www.rigsofrods.com/repository/index/Search.keywords:nHelens)

In 0.38.66 looks ok:
http://s10.postimg.org/5tfhzrdop/2015_05_09_120708_1920x1080_scrot.png

Now (latest git), colors are different and missing elements: http://s10.postimg.org/6rvv21r0p/2015_05_09_120802_1920x1080_scrot.png

RoR.log

Also in single player the water is above the map:
http://s10.postimg.org/tj4xogc21/2015_05_09_120906_1920x1080_scrot.png

RoR.log

Disabling waves fixes the issue. (Thanks Skybon)

@Max98 Max98 added the bug label May 9, 2015

@Max98 Max98 added this to the RoR 0.4.5 (Nextstable) milestone May 9, 2015

@Max98 Max98 self-assigned this May 9, 2015

@Max98

This comment has been minimized.

Show comment
Hide comment
@Max98

Max98 May 9, 2015

Contributor

The coloring problem is just a conversion mistake. So it's not our fault. But for me, going on the same server, all the objects load. The only problem I see is the water about the ground with enabled waves. I'll take a look at your logs.

Contributor

Max98 commented May 9, 2015

The coloring problem is just a conversion mistake. So it's not our fault. But for me, going on the same server, all the objects load. The only problem I see is the water about the ground with enabled waves. I'll take a look at your logs.

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 May 9, 2015

Collaborator

But for me, going on the same server, all the objects load.

In Windows?

Collaborator

tritonas00 commented May 9, 2015

But for me, going on the same server, all the objects load.

In Windows?

@Max98

This comment has been minimized.

Show comment
Hide comment
@Max98

Max98 May 9, 2015

Contributor

Yup, so it can be a problem from AngelScript.

Contributor

Max98 commented May 9, 2015

Yup, so it can be a problem from AngelScript.

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 May 20, 2015

Collaborator

Yup, so it can be a problem from AngelScript.

Is there anyway to debug this? Its a bit annoying :P

Also this map has two spawn places, and because the default one isnt loading it spawn me in the other...

I haven't this problem in 0.38.66

Collaborator

tritonas00 commented May 20, 2015

Yup, so it can be a problem from AngelScript.

Is there anyway to debug this? Its a bit annoying :P

Also this map has two spawn places, and because the default one isnt loading it spawn me in the other...

I haven't this problem in 0.38.66

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Jun 5, 2015

Collaborator

Maybe those angelscript logs are useful

0.38.66
http://pastebin.com/epcwnyVX

latest git
http://pastebin.com/6SCjQvWA

Collaborator

tritonas00 commented Jun 5, 2015

Maybe those angelscript logs are useful

0.38.66
http://pastebin.com/epcwnyVX

latest git
http://pastebin.com/6SCjQvWA

@Hiradur

This comment has been minimized.

Show comment
Hide comment
@Hiradur

Hiradur Jun 6, 2015

Contributor

Which AngelScript version do you use?

EDIT: Happens for me, too, using AS 2.22.1

Contributor

Hiradur commented Jun 6, 2015

Which AngelScript version do you use?

EDIT: Happens for me, too, using AS 2.22.1

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Jun 6, 2015

Collaborator

I use 2.20.3 in 0.38.66 and 2.22.1 in git

Collaborator

tritonas00 commented Jun 6, 2015

I use 2.20.3 in 0.38.66 and 2.22.1 in git

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Jun 12, 2015

Collaborator

Ok i have more problems on this map in multiplayer

Sometimes the game logins fine but sometimes (most) simply crashes.

gdb:

Program received signal SIGSEGV, Segmentation fault.
#0  0x00007ffff7490959 in Ogre::SceneNode::setVisible(bool, bool) () from /opt/ror-next/lib/libOgreMain.so.1.8.1

dmesg:

[ 5290.015378] RoR[5585]: segfault at 100 ip 00007f1b87680959 sp 00007ffd9dd7b940 error 4 in  libOgreMain.so.1.8.1[7f1b872ac000+5d7000]
[ 7901.437099] traps: RoR[5332] general protection ip:7f480f9a8959 sp:7fff4284cc50 error:0 in libOgreMain.so.1.8.1[7f480f5d4000+5d7000]

RoR.log: http://pastebin.com/heRtp2jd

Doesn't happen in 0.38.66.

Maybe some vehicles from other players that are not compatible?

Collaborator

tritonas00 commented Jun 12, 2015

Ok i have more problems on this map in multiplayer

Sometimes the game logins fine but sometimes (most) simply crashes.

gdb:

Program received signal SIGSEGV, Segmentation fault.
#0  0x00007ffff7490959 in Ogre::SceneNode::setVisible(bool, bool) () from /opt/ror-next/lib/libOgreMain.so.1.8.1

dmesg:

[ 5290.015378] RoR[5585]: segfault at 100 ip 00007f1b87680959 sp 00007ffd9dd7b940 error 4 in  libOgreMain.so.1.8.1[7f1b872ac000+5d7000]
[ 7901.437099] traps: RoR[5332] general protection ip:7f480f9a8959 sp:7fff4284cc50 error:0 in libOgreMain.so.1.8.1[7f480f5d4000+5d7000]

RoR.log: http://pastebin.com/heRtp2jd

Doesn't happen in 0.38.66.

Maybe some vehicles from other players that are not compatible?

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Jul 3, 2015

Collaborator

Ok, this issue only shows in x86_64. In i686 all objects load fine:

http://s4.postimg.org/t60n4qrj1/2015_07_03_143715_1920x1080_scrot.png

I had a similar architecture issue in 0.38.66: http://www.rigsofrods.com/threads/108001-segfault-on-x86_64-and-network-(linux)

Collaborator

tritonas00 commented Jul 3, 2015

Ok, this issue only shows in x86_64. In i686 all objects load fine:

http://s4.postimg.org/t60n4qrj1/2015_07_03_143715_1920x1080_scrot.png

I had a similar architecture issue in 0.38.66: http://www.rigsofrods.com/threads/108001-segfault-on-x86_64-and-network-(linux)

@tritonas00

This comment has been minimized.

Show comment
Hide comment
Collaborator

tritonas00 commented Jul 3, 2015

@Hiradur

This comment has been minimized.

Show comment
Hide comment
@Hiradur

Hiradur Jul 4, 2015

Contributor

Perhaps we should try to upgrade Angelscript first. There are some fixes for platform specific problems and compiler flags:
http://www.angelcode.com/angelscript/changes.php

This patch could help with that:
http://www.rigsofrods.com/threads/111217-PATCH-Compiling-against-OGRE-1-9-newest-libcaelum-angelscript

Contributor

Hiradur commented Jul 4, 2015

Perhaps we should try to upgrade Angelscript first. There are some fixes for platform specific problems and compiler flags:
http://www.angelcode.com/angelscript/changes.php

This patch could help with that:
http://www.rigsofrods.com/threads/111217-PATCH-Compiling-against-OGRE-1-9-newest-libcaelum-angelscript

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Jul 4, 2015

Collaborator

Yeap, judging by the errors in log, this should be the fix:

Fixed crash with native calling conventions on Linux 64bit

Collaborator

tritonas00 commented Jul 4, 2015

Yeap, judging by the errors in log, this should be the fix:

Fixed crash with native calling conventions on Linux 64bit

@Hiradur

This comment has been minimized.

Show comment
Hide comment
@Hiradur

Hiradur Jul 16, 2015

Contributor

I fixed the waves in my repo, PR soon.

Contributor

Hiradur commented Jul 16, 2015

I fixed the waves in my repo, PR soon.

@Max98 Max98 assigned Hiradur and unassigned Max98 Jul 16, 2015

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Jul 17, 2015

Collaborator

Ok i have more problems on this map in multiplayer

Sometimes the game logins fine but sometimes (most) simply crashes.

Ok this is due to some probably incompatible vehicles from other players. Loading only the map, without any vehicle, loads fine every time.

Collaborator

tritonas00 commented Jul 17, 2015

Ok i have more problems on this map in multiplayer

Sometimes the game logins fine but sometimes (most) simply crashes.

Ok this is due to some probably incompatible vehicles from other players. Loading only the map, without any vehicle, loads fine every time.

@Hiradur

This comment has been minimized.

Show comment
Hide comment
@Hiradur

Hiradur Jul 17, 2015

Contributor

I always play with ulimit -c unlimited set so if a crash happens I can immediately take a look at it with gdb.

Contributor

Hiradur commented Jul 17, 2015

I always play with ulimit -c unlimited set so if a crash happens I can immediately take a look at it with gdb.

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Jul 17, 2015

Collaborator

Also dmesg says:

RoR[18842] general protection ip:7f779e4cfb99 sp:7ffca9ef11d0 error:0 in libOgreMain.so.1.8.1[7f779e110000+5bd000]
RoR[6283]: segfault at 3dd2c500 ip 00007fbcd68b1b99 sp 00007ffdec4e8da0 error 4 in libOgreMain.so.1.8.1[7fbcd64f2000+5bd000]

and bt:

0x00007ffff7495b99 in Ogre::SceneNode::setVisible(bool, bool) () from /opt/ror-next/lib/libOgreMain.so.1.8.1
Collaborator

tritonas00 commented Jul 17, 2015

Also dmesg says:

RoR[18842] general protection ip:7f779e4cfb99 sp:7ffca9ef11d0 error:0 in libOgreMain.so.1.8.1[7f779e110000+5bd000]
RoR[6283]: segfault at 3dd2c500 ip 00007fbcd68b1b99 sp 00007ffdec4e8da0 error 4 in libOgreMain.so.1.8.1[7fbcd64f2000+5bd000]

and bt:

0x00007ffff7495b99 in Ogre::SceneNode::setVisible(bool, bool) () from /opt/ror-next/lib/libOgreMain.so.1.8.1
@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Jul 17, 2015

Collaborator

Also i have the same packs folders (symlink) with 0.38.66 and next-stable and probably some incompatible vehicles.

I will try with 0.4 content pack only.

Collaborator

tritonas00 commented Jul 17, 2015

Also i have the same packs folders (symlink) with 0.38.66 and next-stable and probably some incompatible vehicles.

I will try with 0.4 content pack only.

@Hiradur Hiradur referenced this issue Jul 17, 2015

Merged

Bug fixes #302

@Hiradur Hiradur changed the title from Problems with nHelens terrain in multiplayer and single mode (Linux) to Angelscript not working correctly on Linux Jul 18, 2015

@Hiradur

This comment has been minimized.

Show comment
Hide comment
@Hiradur

Hiradur Jul 18, 2015

Contributor

@tritonas00 It would be great if you could make a new issue for that after you verified it's not a 0.38/0.4 compatibility problem.

Contributor

Hiradur commented Jul 18, 2015

@tritonas00 It would be great if you could make a new issue for that after you verified it's not a 0.38/0.4 compatibility problem.

@Speciesx

This comment has been minimized.

Show comment
Hide comment
@Speciesx

Speciesx Jul 19, 2015

Contributor

Here is an updated Version of this terrain. I've changed the detail texture and disabled the contained Caelum file.

ror_2015_07_19_12_23_45_786

https://www.dropbox.com/s/nnf1jm20yg1h5au/nhelens.zip?dl=0

Contributor

Speciesx commented Jul 19, 2015

Here is an updated Version of this terrain. I've changed the detail texture and disabled the contained Caelum file.

ror_2015_07_19_12_23_45_786

https://www.dropbox.com/s/nnf1jm20yg1h5au/nhelens.zip?dl=0

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Jul 19, 2015

Collaborator

wow thanks @Speciesx

@Hiradur if i load with only the terrain it never crashes. Also, with content pack, it crashes after some player spawns a vehicle/container that i have it. If i dont have it, its ok. Many users use 0.38 in multiplayer.

Collaborator

tritonas00 commented Jul 19, 2015

wow thanks @Speciesx

@Hiradur if i load with only the terrain it never crashes. Also, with content pack, it crashes after some player spawns a vehicle/container that i have it. If i dont have it, its ok. Many users use 0.38 in multiplayer.

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Jul 19, 2015

Collaborator

for example, now i downloaded 0.4 Content Pack, and crashed after some user loaded some container (saw it in chat). Retried 2-3 times still crashed because of that. I removed ISOcontainers.zip and no crashes so far.

Collaborator

tritonas00 commented Jul 19, 2015

for example, now i downloaded 0.4 Content Pack, and crashed after some user loaded some container (saw it in chat). Retried 2-3 times still crashed because of that. I removed ISOcontainers.zip and no crashes so far.

@Max98

This comment has been minimized.

Show comment
Hide comment
@Max98

Max98 Jul 19, 2015

Contributor

@tritonas00 The current Upstream does crash in multiplayer when something gets spawned.
It's also angelscript related, and I'm working on it.

Contributor

Max98 commented Jul 19, 2015

@tritonas00 The current Upstream does crash in multiplayer when something gets spawned.
It's also angelscript related, and I'm working on it.

@Hiradur

This comment has been minimized.

Show comment
Hide comment
@Hiradur

Hiradur Jul 19, 2015

Contributor

@tritonas00 If you feel desperate you could check with up to which version of AngelScript RoR compiles without modifying the code.

Contributor

Hiradur commented Jul 19, 2015

@tritonas00 If you feel desperate you could check with up to which version of AngelScript RoR compiles without modifying the code.

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Jul 19, 2015

Collaborator

@Hiradur already tried that :P

If i remember correctly it fails with everything above 2.22.*

@Max98 👍

Collaborator

tritonas00 commented Jul 19, 2015

@Hiradur already tried that :P

If i remember correctly it fails with everything above 2.22.*

@Max98 👍

@Max98 Max98 modified the milestones: Post-Nextstable, RoR 0.4.5 (Nextstable) Aug 11, 2015

@Hiradur

This comment has been minimized.

Show comment
Hide comment
@Hiradur

Hiradur Aug 28, 2015

Contributor

quote from only_a_ptr:

The AngelScript in RoR-Deps-26 [Windows] is slightly hacked. We need to download clean SRC of corresponding AngelScript version and DIFF it to see what's changed.

    The script loading (CScriptLoader IIRC) interface is modified to allow subclassing + using OGRE resource system; specifically, one function is changed to "virtual" directly in AS headers.

    One more hack I've seen involves a macro with 1 assembly instruction - I'm unable to remember where exactly this was.
Contributor

Hiradur commented Aug 28, 2015

quote from only_a_ptr:

The AngelScript in RoR-Deps-26 [Windows] is slightly hacked. We need to download clean SRC of corresponding AngelScript version and DIFF it to see what's changed.

    The script loading (CScriptLoader IIRC) interface is modified to allow subclassing + using OGRE resource system; specifically, one function is changed to "virtual" directly in AS headers.

    One more hack I've seen involves a macro with 1 assembly instruction - I'm unable to remember where exactly this was.

@Hiradur Hiradur changed the title from Angelscript not working correctly on Linux to Angelscript not working correctly on Linux x86_64 Sep 28, 2015

@Hiradur

This comment has been minimized.

Show comment
Hide comment
@Hiradur

Hiradur Sep 28, 2015

Contributor

AS update is also needed because RoR doesn't link against 2.22.1 on ARMv7

Contributor

Hiradur commented Sep 28, 2015

AS update is also needed because RoR doesn't link against 2.22.1 on ARMv7

@Hiradur Hiradur modified the milestones: Post-Nextstable, 0.4.6.0 Oct 24, 2015

@only-a-ptr

This comment has been minimized.

Show comment
Hide comment
@only-a-ptr

only-a-ptr Dec 15, 2015

Member

One known source of platform-dependent issues is function calling-conventions: http://www.angelcode.com/angelscript/sdk/docs/manual/doc_generic.html

Member

only-a-ptr commented Dec 15, 2015

One known source of platform-dependent issues is function calling-conventions: http://www.angelcode.com/angelscript/sdk/docs/manual/doc_generic.html

@Hiradur

This comment has been minimized.

Show comment
Hide comment
@Hiradur

Hiradur Dec 15, 2015

Contributor

@only-a-ptr Yep, Angelscript.log is full of errors like this one on Linux amd64:

19:48:58:  (0, 0): Error = Don't support returning type 'vector3' by value from application in native calling convention on this platform

There is a way to hack around them but instead we should just upgrade AS, it now even has native calling convetions on MIPS...
It would also make packaging easier.

I already started to upgrade AS but there are a lot of ScriptEngine errors at runtime, here is my branch:
https://github.com/Hiradur/rigs-of-rods/tree/angelscript-update

Contributor

Hiradur commented Dec 15, 2015

@only-a-ptr Yep, Angelscript.log is full of errors like this one on Linux amd64:

19:48:58:  (0, 0): Error = Don't support returning type 'vector3' by value from application in native calling convention on this platform

There is a way to hack around them but instead we should just upgrade AS, it now even has native calling convetions on MIPS...
It would also make packaging easier.

I already started to upgrade AS but there are a lot of ScriptEngine errors at runtime, here is my branch:
https://github.com/Hiradur/rigs-of-rods/tree/angelscript-update

@only-a-ptr

This comment has been minimized.

Show comment
Hide comment
@only-a-ptr

only-a-ptr Dec 22, 2015

Member

@Hiradur 👍 for doing this daunting job.

Member

only-a-ptr commented Dec 22, 2015

@Hiradur 👍 for doing this daunting job.

@Bob-Z

This comment has been minimized.

Show comment
Hide comment
@Bob-Z

Bob-Z Dec 24, 2015

Contributor

my 2 cents: I have the multi-player crash on my x86_64 bits machine too. The crash happens in Beam::setCustomLightVisible on the client which has NOT spawned the vehicle.
netCustomLightArray[number] seems to be always set to -1 for some vehicles, which leads to the crash at this line:

if (flares[netCustomLightArray[number]].snode)

A quick workaround is as follow:

diff --git a/source/main/physics/Beam.cpp b/source/main/physics/Beam.cpp
index 5be63dd..46bceac 100644
--- a/source/main/physics/Beam.cpp
+++ b/source/main/physics/Beam.cpp
@@ -6742,6 +6742,11 @@ void Beam::setCustomLightVisible(int number, bool visible)
                return;
        }

+       if (netCustomLightArray[number] == -1)
+       {
+               return;
+       }
+
        try
        {
                if (flares[netCustomLightArray[number]].snode)

With this code, I have no crash anymore but some vehicles are sometimes spawned with abnormal meshes:

screenshot_1

I will test Hiradur AS update as soon as it will be available, thanks Hiradur.

Contributor

Bob-Z commented Dec 24, 2015

my 2 cents: I have the multi-player crash on my x86_64 bits machine too. The crash happens in Beam::setCustomLightVisible on the client which has NOT spawned the vehicle.
netCustomLightArray[number] seems to be always set to -1 for some vehicles, which leads to the crash at this line:

if (flares[netCustomLightArray[number]].snode)

A quick workaround is as follow:

diff --git a/source/main/physics/Beam.cpp b/source/main/physics/Beam.cpp
index 5be63dd..46bceac 100644
--- a/source/main/physics/Beam.cpp
+++ b/source/main/physics/Beam.cpp
@@ -6742,6 +6742,11 @@ void Beam::setCustomLightVisible(int number, bool visible)
                return;
        }

+       if (netCustomLightArray[number] == -1)
+       {
+               return;
+       }
+
        try
        {
                if (flares[netCustomLightArray[number]].snode)

With this code, I have no crash anymore but some vehicles are sometimes spawned with abnormal meshes:

screenshot_1

I will test Hiradur AS update as soon as it will be available, thanks Hiradur.

@DirtGamer301

This comment has been minimized.

Show comment
Hide comment
@DirtGamer301

DirtGamer301 Dec 24, 2015

The vehicles spawning with weird wheels are a multiplayer problem I think. It might be caused by flexbodywheels, but I'm not sure.
I remember in various MP sessions, for example with TJ Sammy this always happaned.

DirtGamer301 commented Dec 24, 2015

The vehicles spawning with weird wheels are a multiplayer problem I think. It might be caused by flexbodywheels, but I'm not sure.
I remember in various MP sessions, for example with TJ Sammy this always happaned.

@DevRain2500

This comment has been minimized.

Show comment
Hide comment
@DevRain2500

DevRain2500 Dec 25, 2015

The flextires issue can be found here: #253

DevRain2500 commented Dec 25, 2015

The flextires issue can be found here: #253

@tritonas00

This comment has been minimized.

Show comment
Hide comment
@tritonas00

tritonas00 Dec 25, 2015

Collaborator

@Bob-Z are you talking about #459 ?

Collaborator

tritonas00 commented Dec 25, 2015

@Bob-Z are you talking about #459 ?

@Bob-Z

This comment has been minimized.

Show comment
Hide comment
@Bob-Z

Bob-Z Dec 25, 2015

Contributor

@tritonas00 Oups yes it is #459. I didn't see it, sorry.
@Dogy144 Thanks, I will take more time reading existing bugs before reporting next time.

Contributor

Bob-Z commented Dec 25, 2015

@tritonas00 Oups yes it is #459. I didn't see it, sorry.
@Dogy144 Thanks, I will take more time reading existing bugs before reporting next time.

This was referenced Jan 4, 2016

Hiradur added a commit to Hiradur/rigs-of-rods that referenced this issue Jan 10, 2016

[Fix] AS: Pass by value for Ogre types
"On Linux/amd64 with GNUC a class is treated very differently if the copy constructor is declared or not. A class with a copy constructor is always passed through a reference even when the function is declared to pass the type by value. When the copy constructor is not declared, the compiler will pass the type in the CPU registers instead, if the class is small enough. The real complicated part is that when the type is passed in the CPU registers, it is split up by the type of each member, so integer members are passed in the general purpose registers, and float members are passed in the floating point registers. This is why AngelScript doesn't allow these types to be passed by value, the implementation to support that in the native calling convention is just too difficult."

"I've added an additional flag asOBJ_APP_ALLFLOATS that when used with the registration of the Ogre::Vector3 should allow you to use this type in native functions without wrappers. It tells AngelScript that the class consists only of floats, and will thus allow AngelScript to know that the type is returned in the XMM registers instead of the general purpose registers." - A. Jonsson, AS dev

fixes RigsOfRods#462 RigsOfRods#174

@tritonas00 tritonas00 closed this Jan 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment