Exception thrown in extern C method · Issue #975 · eventmachine/eventmachine · GitHub
Skip to content

Exception thrown in extern C method #975

Open

Description

@ls5302

Running the test_basic.rb on windows results in the following tests aborting:

test_invalid_address_bind_connect_dst
test_invalid_address_bind_connect_src

The expectation is for the EventMachine_t::ConnectToServer method to throw an exception, and for it to bubble up into Ruby.

I think the issue is that the evma_connect_to_server method link is declared as extern "C", which causes the exception to cross language barriers.

Not sure how to fix it yet, but thought it might be worth a discussion.

I see this has been mentioned before #99

Do we just need to add the -fexceptions option to gcc?

Activity

  1. MSP-Greg commented on Oct 6, 2022

    @MSP-Greg
    Contributor

    What version/build of Ruby were you using? I just ran Actions CI in my fork, and all the Windows jobs passed with the exception of 2.5, which was probably an intermittent failure due to a slow CI runner.

  2. ls5302 commented on Oct 6, 2022

    @ls5302
    Author

    Ruby 3.1 and Eventmachine 1.2,7 (32-bit). The tests I mention have been pended in master.

    I'm playing around with the gcc flag and it doesn't appear to make any difference.

    What has worked is modifying the em.cpp code to return an error code, rather than throw. The tests now run, and fail due to a error message mismatch which is expected as the "no connection" is text in the eb_raise call.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions