Skip to content
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

Error: undefined method 'wait_readable' for TCPSocket (compile-time type is TCPSocket+) #22

Open
GrantBirki opened this issue Jan 17, 2025 · 4 comments

Comments

@GrantBirki
Copy link

I am getting the following compile time error when using crystal-lang v1.15.0

ssh2/src/session.cr:39:13

 39 | @socket.wait_readable if flags.inbound?
              ^------------
Error: undefined method 'wait_readable' for TCPSocket (compile-time type is TCPSocket+)
@stakach
Copy link
Member

stakach commented Jan 17, 2025

Yeah it’s due to the new reactor stuff in Crystal 1.15
I was using an internal (not public API) method which didn’t have a Windows equivalent.

Ssh2 relies on this to be non blocking I think so we’ll need to work out an alternative going forward. Also might be possible to add windows support- but it might be awhile before I get around to patching this

@GrantBirki
Copy link
Author

@stakach Due to the way that eventpolling was updated, I'm not actually sure you need to call these private methods at all -> https://github.com/crystal-lang/crystal/blob/master/src/crystal/event_loop/polling.cr

I think they get called internally now so you might be able to fix this by just removing this method:

private def waitsocket
  flags = block_directions
  @socket.wait_readable if flags.inbound?
  @socket.wait_writable if flags.outbound?
end

And other calls to the waitsocket method.

@vitobotta
Copy link

Hi, is there a workaround for this? I am having a hard time building a binary on macOS with Github Actions and the homebrew formula has been updated to Crystal 1.15. Thanks

@stakach
Copy link
Member

stakach commented Jan 27, 2025

Only workaround is to continue using crystal 1.14 for now
we'll need language support for it or I guess we could monkey patch it back in:

Might be able to use select to perform the check on a file descriptor

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

No branches or pull requests

3 participants