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

TCPSocket#write is failed #5943

Closed
bamchoh opened this issue Mar 3, 2023 · 3 comments
Closed

TCPSocket#write is failed #5943

bamchoh opened this issue Mar 3, 2023 · 3 comments

Comments

@bamchoh
Copy link
Contributor

bamchoh commented Mar 3, 2023

Hi, thank you very much for development of mruby

I found a issue. I executed below script (test.rb) by command prompt like mruby.exe test.rb

TCPServer.open("127.0.0.1", 0) { |serv|
  c = TCPSocket.new(*serv.addr.values_at(3,1))
  s = serv.accept

  c.send "foo", 4
  p s.recv(10)

  c.write "bar"
  p s.recv(10)
}

Then an below exception happens

trace (most recent call last):
        [3] test.rb:1
        [2] test.rb:1:in open
        [1] test.rb:8
test.rb:8:in write: Bad file descriptor - syswrite (Errno::EBADF)
  • I don't face this issue with 3.1.0. When I use 3.2.0, this issue occurs.

  • I'm Windows user. I'm using Windows 10 Pro or Windows 11. I found this issue with both Windows version.

  • I'm building mruby.exe by using ridk which is installed by Ruby installer for Windows (`3.1.2p20 ) like below command.

ridk exec rake all test
@matz
Copy link
Member

matz commented Mar 3, 2023

I got it. I re-implemented IO methods in C, so that dynamic binding does not work for Windows.
I will address the issue somehow soon.

@matz matz closed this as completed in 42d3efe Mar 3, 2023
@bamchoh
Copy link
Contributor Author

bamchoh commented Mar 3, 2023

Thank you very much for quick fix. I could write with TCPSocket#write method.

@matz
Copy link
Member

matz commented Mar 3, 2023

Probably we will release 3.2.1 soon.

mimaki pushed a commit to mruby-Forum/mruby that referenced this issue Mar 4, 2023
…ruby#5943

Since normal file descriptors and sockets cannot be mixed on the
platform.
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

2 participants