Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Exception while closing gateway #161

Closed
AdamMachera opened this issue Mar 10, 2017 · 3 comments
Closed

Exception while closing gateway #161

AdamMachera opened this issue Mar 10, 2017 · 3 comments
Assignees

Comments

@AdamMachera
Copy link

I'm creating gateway from c# using those function

    [DllImport("gateway.dll", CharSet=CharSet.Ansi, EntryPoint = "Gateway_CreateFromJson", CallingConvention = CallingConvention.Cdecl)]
    public static extern IntPtr GatewayCreateFromJson([MarshalAs(UnmanagedType.LPStr)] string filePath);
    [DllImport("gateway.dll", EntryPoint = "Gateway_Destroy", CallingConvention = CallingConvention.Cdecl)]
    public static extern IntPtr GatewayDestroy(IntPtr gateway);

Gateway is using nodejs and c# modules.
From time to time if I try to close gatewat I'm getting exception from node.cc
Bolded code throws exception:

Unhandled exception at 0x00007FF8F5016DF0 in IoTClient.exe: 0xC0000005: Access violation executing location 0x00007FF8F5016DF0.

if (instance_data->use_debug_agent())
  EnableDebug(env);

{
  SealHandleScope seal(isolate);
  bool more;
  node::node_loop_func loop_func = instance_data->loop_func();
  do {
    if(loop_func != NULL) {
      loop_func(isolate);
    }
    **v8_platform.PumpMessageLoop(isolate);**
    more = uv_run(env->event_loop(), UV_RUN_ONCE);

    if (more == false) {
      v8_platform.PumpMessageLoop(isolate);
      EmitBeforeExit(env);

      // Emit `beforeExit` if the loop became alive either after emitting
      // event, or after running some callbacks.
      more = uv_loop_alive(env->event_loop());
      if (uv_run(env->event_loop(), UV_RUN_NOWAIT) != 0)
        more = true;
    }
  } while (more == true);
}
@avranju
Copy link
Contributor

avranju commented Mar 15, 2017

This issue is under investigation.

@avranju
Copy link
Contributor

avranju commented Mar 22, 2017

I have not been able to reproduce this issue.

@aribeironovaes
Copy link
Contributor

Hi @AdamMachera.
Problem found and PR created to fix this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants