opencog / unity3d-opencog-game

A Unity3D game world for OpenCog-controlled agents
http://wiki.opencog.org/w/Setting_up_the_Unity3D_world
GNU Affero General Public License v3.0
56 stars 40 forks source link

Linux player not connecting #15

Open cosmoharrigan opened 10 years ago

cosmoharrigan commented 10 years ago

When I manually test the connection between the Unity players and embodiment, I observe that the Windows player connects successfully, but the Linux player fails to connect.

The Linux console only displays:

> /load AGI_Robot
Starting OAC named AGI_Robot

Whereas the Windows console displays:

> /load AGI_Robot
Start Connecting to router on IP 192.168.0.28:16312...
Starting OAC named AGI_Robot

We need to debug why the Linux player is not getting to this line in the ConnectOAC method of OCConnectorSingleton.cs

since we don't yet have automated testing of players (see https://github.com/opencog/opencog/issues/401)

cosmoharrigan commented 10 years ago

I noticed that the following error appears in ~/.config/unity3d/DefaultCompany/OpenCog-Unity3D-Game/Player.log:

In InitializeNetworkElement, my GUID is 3945d209-31e1-49ff-980c-65ef07216125

(Filename: /BuildAgent/work/cac08d8a5e25d4cb/Runtime/ExportGenerated/LinuxStandalonePlayer/UnityEngineDebug.cpp Line: 54)

Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib
Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib.so
Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib
Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib.so
Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib
Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib
Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib.so
Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib
Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib.so
Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib
DllNotFoundException: libc.dylib
  at (wrapper managed-to-native) System.Net.NetworkInformation.NetworkInterface:uname (intptr)
  at System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces () [0x00000] in <filename unknown>:0 
  at OpenCog.Network.OCNetworkElement.InitializeNetworkElement (System.String id) [0x00000] in <filename unknown>:0 
  at OCConnectorSingleton.Init (System.String agentName, System.String agentTraits, System.String agentType, System.String masterId, System.String masterName) [0x00000] in <filename unknown>:0 
  at OpenCog.Utility.Console.LoadCommand+<LoadAgent>c__IteratorE.MoveNext () [0x00000] in <filename unknown>:0 
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
OpenCog.Utility.Console.LoadCommand:Run(ArrayList)
OpenCog.Utility.Console.Console:ProcessConsoleLine(String)
OpenCog.Utility.Console.Console:Update()
Nemquae commented 10 years ago

Yeah, I'm still looking into it. I've got a fix a problem with my laptop first, but I think I can solve this by the end of the day...

On Mon, Mar 3, 2014 at 1:10 PM, Cosmo Harrigan notifications@github.comwrote:

I noticed that the following error appears in ~/.config/unity3d/DefaultCompany/OpenCog-Unity3D-Game/Player.log:

In InitializeNetworkElement, my GUID is 3945d209-31e1-49ff-980c-65ef07216125

(Filename: /BuildAgent/work/cac08d8a5e25d4cb/Runtime/ExportGenerated/LinuxStandalonePlayer/UnityEngineDebug.cpp Line: 54)

Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib.so Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib.so Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib.so Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib.so Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib DllNotFoundException: libc.dylib at (wrapper managed-to-native) System.Net.NetworkInformation.NetworkInterface:uname (intptr) at System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces () [0x00000] in :0 at OpenCog.Network.OCNetworkElement.InitializeNetworkElement (System.String id) [0x00000] in :0 at OCConnectorSingleton.Init (System.String agentName, System.String agentTraits, System.String agentType, System.String masterId, System.String masterName) [0x00000] in :0 at OpenCog.Utility.Console.LoadCommand+c__IteratorE.MoveNext () [0x00000] in :0 UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) OpenCog.Utility.Console.LoadCommand:Run(ArrayList) OpenCog.Utility.Console.Console:ProcessConsoleLine(String) OpenCog.Utility.Console.Console:Update()

Reply to this email directly or view it on GitHubhttps://github.com/opencog/unity3d-opencog-game/issues/15#issuecomment-36482177 .

Nemquae commented 10 years ago

So I'm going to need to pause on this while I work on the ITF demo, but here's what I've been able to figure out: the libc library isn't found because a simple replacement in monodevelop's config file results in " libc.dylib.so" instead of "libc.so" in addition to the fact that libc.conf (and the other config files) in ld.so.conf.d aren't being referenced by the Unity Player.

I can fix the first problem by changing the config file installed for monodevelop/unity, but I can't find a solution to the second problem. It's possible that just changing the environment variable pointing to these libraries might help, but since this problem just crept up recently, I'm thinking that it must be something that changed on Unity's end. I'm inclined to wait a bit before changing their installed configs or potentially creating problems with the environment variables. I don't know much about Ubuntu/Linux though, so I'm open to suggestions.

On Mon, Mar 3, 2014 at 1:11 PM, Lake Watkins nemquae@gmail.com wrote:

Yeah, I'm still looking into it. I've got a fix a problem with my laptop first, but I think I can solve this by the end of the day...

On Mon, Mar 3, 2014 at 1:10 PM, Cosmo Harrigan notifications@github.comwrote:

I noticed that the following error appears in ~/.config/unity3d/DefaultCompany/OpenCog-Unity3D-Game/Player.log:

In InitializeNetworkElement, my GUID is 3945d209-31e1-49ff-980c-65ef07216125

(Filename: /BuildAgent/work/cac08d8a5e25d4cb/Runtime/ExportGenerated/LinuxStandalonePlayer/UnityEngineDebug.cpp Line: 54)

Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib.so Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib.so Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib.so Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/./libc.dylib.so Fallback handler could not load library /home/cosmo/opencog-unity/Unity3DGameWorldPlayer_Linux64_Data/Mono/x86_64/libc.dylib DllNotFoundException: libc.dylib at (wrapper managed-to-native) System.Net.NetworkInformation.NetworkInterface:uname (intptr) at System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces () [0x00000] in :0 at OpenCog.Network.OCNetworkElement.InitializeNetworkElement (System.String id) [0x00000] in :0 at OCConnectorSingleton.Init (System.String agentName, System.String agentTraits, System.String agentType, System.String masterId, System.String masterName) [0x00000] in :0 at OpenCog.Utility.Console.LoadCommand+c__IteratorE.MoveNext () [0x00000] in :0 UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) OpenCog.Utility.Console.LoadCommand:Run(ArrayList) OpenCog.Utility.Console.Console:ProcessConsoleLine(String) OpenCog.Utility.Console.Console:Update()

Reply to this email directly or view it on GitHubhttps://github.com/opencog/unity3d-opencog-game/issues/15#issuecomment-36482177 .

cosmoharrigan commented 10 years ago

Here's a post about a bug with the same symptoms in the Mono bug tracker: https://bugzilla.xamarin.com/show_bug.cgi?id=16250

cosmoharrigan commented 10 years ago

@ngeiswei

The exception is caused by the System.Net.NetworkInformation class which is included here when the GetAllNetworkInterfaces method is called. This had been added to handle smart detection of the system's IP address in the case that the system had multiple network adapters as can be observed in the change history.

But for some reason, this class is not working properly when the player is built for Linux. Perhaps @Nemquae has some ideas about what could be causing this related to Mono, .NET 2.0, and Unity3D DLLs.

If I revert that section to the previous version that doesn't use the System.Net.NetworkInformation class (which didn't work properly in the specific case when the system had multiple network adapters), then I am able to successfully connect with the Linux player.

Alex-van-der-Peet commented 10 years ago

Glad you figured it out, must have been tricky!

How about wrapping it into something like this for now? So Windows users keep the added value of the smart IP address selection.

if UNITY_STANDALONE_LINUX

// Old stuff

else

// Smart stuff

endif

Or is that an undesirable hack?

From: Cosmo Harrigan [mailto:notifications@github.com] Sent: 05 March 2014 12:50 To: opencog/unity3d-opencog-game Subject: Re: [unity3d-opencog-game] Linux player not connecting (#15)

@ngeiswei https://github.com/ngeiswei

The exception is caused by the System.Net.NetworkInformation class which is included here https://github.com/opencog/unity3d-opencog-game/blob/master/Assets/OpenCog%20Assets/Scripts/OpenCog/Network/OCNetworkElement.cs#L26 when the GetAllNetworkInterfaces method is called. This had been added to handle smart detection of the system's IP address in the case that the system had multiple network adapters as can be observed in the change history https://github.com/opencog/unity3d-opencog-game/commits/master/Assets/OpenCog%20Assets/Scripts/OpenCog/Network/OCNetworkElement.cs .

But for some reason, this class is not working properly when the player is built for Linux. Perhaps @Nemquae https://github.com/Nemquae has some ideas about what could be causing this related to Mono, .NET 2.0, and Unity3D DLLs.

If I revert that section to the previous version that doesn't use the System.Net.NetworkInformation class (which didn't work properly in the specific case when the system had multiple network adapters), then I am able to successfully connect with the Linux player.

— Reply to this email directly or view it on GitHub https://github.com/opencog/unity3d-opencog-game/issues/15#issuecomment-36709935 . https://github.com/notifications/beacon/2569494__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcwOTYxNDE5NCwiZGF0YSI6eyJpZCI6MjAzMjQ1NjZ9fQ==--d237e9655d7acd6655722aab295ef6fed66ec230.gif


No virus found in this message. Checked by AVG - www.avg.com Version: 2014.0.4259 / Virus Database: 3705/7153 - Release Date: 03/04/14

githart commented 10 years ago

Can ROUTER_IP:127.0.0.1 be hardcoded as a default? (overridable by command line argument or System.Net.NetworkInformation if that can be used in portable way?)

In the common Linux use (everything run on one machine), or with VMs/containers and port forwarding, the loopback address is the simplest approach.

cosmoharrigan commented 10 years ago

@githart I think that would be a good idea, and someone should try testing that, but note that ROUTER_IP is separate from the _IP variable referred to in the last comment, which is used to construct a command string to send to the router here.

cosmoharrigan commented 10 years ago

@Alex-van-der-Peet maybe so, but I'm curious first to see if @Nemquae has any ideas about including that class...

githart commented 10 years ago

I can confirm that Cosmo's https://github.com/opencog/unity3d-opencog-game/commit/36e42bd016b0e2d615ce7fc9d2583b8827f019d7 fixes this issue.

Unity3DGameWorldPlayer_Linux64 ROUTER_IP:127.0.0.1 

connects to containerized embodiment servers build with the Dockerfile at https://gist.github.com/githart/9361814 (replace the existing Dockerfile in the opencog source directory).

Nemquae commented 10 years ago

Thanks Cosmo!

I can change that to be the default, sure and include it to the config file / command line params.

So I'm looking at that NetworkInferface class interface, and it says it's a new addition to the .NET 2.0 framework, which makes me suspect that it's not universally supported in the .NET 2.0 subset that MonoDevelop uses, similar to the threading classes (even though we explicitly link with the full .NET 2.0 library).

I didn't notice you add that before, but it would make sense that that was the culprit since we know the Linux Player was working when last we extensively tested it. I would suspect that it would generate a different error though, or that we'd see something other than a linking error.

I'll keep thinking about it, but today I'm mainly working toward our ITF demo.

On Wed, Mar 5, 2014 at 1:35 PM, Cosmo Harrigan notifications@github.comwrote:

@Alex-van-der-Peet https://github.com/Alex-van-der-Peet maybe so, but I'm curious first to see if @Nemquae https://github.com/Nemquae has any ideas about including that class...

Reply to this email directly or view it on GitHubhttps://github.com/opencog/unity3d-opencog-game/issues/15#issuecomment-36711788 .