allenai / ai2thor

An open-source platform for Visual AI.

Home Page:http://ai2thor.allenai.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unity SocketException: The socket has been shut down

PCoelho opened this issue · comments

I'm trying to run the simplest possible example using Unity within the editor. My server looks like this:

import ai2thor.controller
controller = ai2thor.controller.Controller(start_unity=False,
    port=8200,
    server_class=ai2thor.wsgi_server.WsgiServer,
    scene = "FloorPlan1_physics")

In Unity I'm opening the FloorPlan1_physics scene and pressing play. I added some debugs to wsgi_server.py and it seems to be receiving one event and sending out an action:

Received: <ai2thor.server.Event at 0x12cc93620
    .metadata["lastAction"] = None
    .metadata["lastActionSuccess"] = False
    .metadata["errorMessage"] = "None
    .metadata["actionReturn"] = None>
Sent: {'action': 'GetScenesInBuild'}

Unity then seems to send a second event, I'm assuming it's in response to GetScenesInBuild, but it fails with the error:

SocketException: The socket has been shut down
System.Net.Sockets.Socket.Send (System.Byte[] buffer, System.Int32 offset, System.Int32 size, System.Net.Sockets.SocketFlags socketFlags) (at <9768a808b86b4f53a2ebaf80bce151fe>:0)
System.Net.Sockets.Socket.Send (System.Byte[] buffer) (at <9768a808b86b4f53a2ebaf80bce151fe>:0)
AgentManager+<EmitFrame>d__102.MoveNext () (at Assets/Scripts/AgentManager.cs:1587)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/Coroutines.cs:17)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:189)

I'm guessing I'm doing something wrong. Can someone help?