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

windows IO::EOFError #18

Open
dsisnero opened this issue Jul 2, 2024 · 2 comments
Open

windows IO::EOFError #18

dsisnero opened this issue Jul 2, 2024 · 2 comments

Comments

@dsisnero
Copy link

dsisnero commented Jul 2, 2024

I was able to compile a simple grpc example. when I run the client, I get the following error

C:\windows_home\src\dsisnero\crystal_examples\grpc_test>bin\grpc_client.exe
hostname_arg # => "localhost:5001"
hostname # => "localhost"
port # => 5001
Unhandled exception: End of file reached (IO::EOFError)
  from C:\windows_home\.local\share\scoop\apps\crystal\current\src\io.cr:525 in 'read_fully'
  from lib\grpc\src\http2.cr:247 in 'read'
  from C:\windows_home\.local\share\scoop\apps\crystal\current\src\io.cr:286 in 'read_byte'
  from lib\protobuf\src\protobuf\buffer.cr:21 in 'read_uint64'
  from lib\protobuf\src\protobuf\buffer.cr:131 in 'read_info'
  from src\protobufs\hello_world.pb.cr:16 in 'initialize'
  from src\protobufs\hello_world.pb.cr:16 in 'new'
  from src\protobufs\hello_world.pb.cr:16 in 'from_protobuf'
  from src\protobufs\hello_world_services.pb.cr:34 in 'say_hello'
  from src\client.cr:13 in 'main'
  from src\client.cr:19 in '__crystal_main'
  from C:\windows_home\.local\share\scoop\apps\crystal\current\src\crystal\main.cr:129 in 'main_user_code'
  from C:\windows_home\.local\share\scoop\apps\crystal\current\src\crystal\main.cr:115 in 'main'
  from C:\windows_home\.local\share\scoop\apps\crystal\current\src\crystal\main.cr:141 in 'main'
  from C:\windows_home\.local\share\scoop\apps\crystal\current\src\crystal\system\win32\wmain.cr:37 in 'wmain'
  from D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 in '__scrt_common_main_seh'
  from C:\WINDOWS\System32\KERNEL32.DLL +75133 in 'BaseThreadInitThunk'
  from C:\WINDOWS\SYSTEM32\ntdll.dll +372520 in 'RtlUserThreadStart'

The client file is as follows:

require "./protobufs/hello_world_services.pb"
require "./protobufs/hello_world.pb"

def main
  user = (ARGV.size > 0) ? ARGV[0] : "world"
  hostname_arg = (ARGV.size > 1) ? ARGV[1] : "localhost:5001"
  pp! hostname_arg
  hostname, port = hostname_arg.split(":")
  port = port ? port.to_i32 : 5001
  pp! hostname
  pp! port
  stub = Greeter::Stub.new("localhost", 50000)
  message = stub.say_hello(HelloRequest.new(name: user)).message
  p "Greeting: #{message}"
  message = stub.say_hello_again(HelloRequest.new(name: user)).message
  p "Greeting: #{message}"
end

main
@jgaskins
Copy link
Owner

Can you describe what is supposed to be happening here? I ask because you're parsing/defaulting to port 5001 from ARGV, but then hardcoding port 50000 on line 13, so I can't tell if the bug is this shard or your app code. Your stack trace points to line 13, so the problem is in either the connection or the handshake, before a request is sent.

@dsisnero
Copy link
Author

just a basic test I actually hard code to "localhost", 50000 for both client and server . Code is here grpc_test

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