mickel8

mickel8

Membrane Core Team

Hi, I am trying to stream data to Google Cloud Speech-To-Text and receive a response but almost every request ends up with an error

%GRPC.RPCError{status: 2, message: "unexpected when waiting for headers: {:data, <<0, 0, 0, 0, 62, 42, 4, 50, 2, 8, 21, 50, 54, 10, 34, 10, 27, 32, 109, 97, 121, 98, 101, 32, 109, 97, 121, 98, 101, 32, 115, 111, 109, 101, 116, 104, 105, 110, 103, 32, 101, 108, 115, 101, 21, 57, 172, 96, ...>>}"}

or

%GRPC.RPCError{status: 2, message: "unexpected when waiting for headers: {:trailers, [{\"grpc-status\", \"0\"}, {\"content-disposition\", \"attachment\"}, {\"x-goog-ext-27651507-bin\", \"DbOLmjwVzczMPQ==\"}, {\"x-goog-ext-9650773-bin\", \"DUh68T8=\"}]}"}

The flow is more or less

    GRPC.Stub.connect(@service_url,
      cred: cred,
      adapter_opts: adapter_opts,
      adapter: GRPC.Client.Adapters.Gun,
      headers: %{
        "Authorization" => authorization_header(),
        "Content-Type" => "application/grpc"
      }
    )

    GRPC.Stub.send_request(stream, request)
    GRPC.Stub.recv(stream, timeout: timeout)

When I changed the adapter from Gun to Mint, the library crashes

[error] GenServer #PID<0.16840.0> terminating
** (ArgumentError) request with request reference #Reference<0.200553127.2209087489.150902> was not found
    (mint 1.4.2) lib/mint/http2.ex:765: Mint.HTTP2.get_window_size/2
    (grpc 0.6.0) lib/grpc/client/adapters/mint/connection_process/connection_process.ex:347: GRPC.Client.Adapters.Mint.ConnectionProcess.get_window_size/2
    (grpc 0.6.0) lib/grpc/client/adapters/mint/connection_process/connection_process.ex:205: GRPC.Client.Adapters.Mint.ConnectionProcess.handle_continue/2
    (stdlib 5.1.1) gen_server.erl:1067: :gen_server.try_handle_continue/3
    (stdlib 5.1.1) gen_server.erl:977: :gen_server.loop/7
    (stdlib 5.1.1) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
Last message: {:continue, :process_request_stream_queue}

Showing Posts 1 to 1

mickel8

mickel8 OP

Membrane Core Team

Okay I found the problem

That’s because of my default handle_info callback which drops messages. Gun by default sends messages to a process that spawns it. Because it’s my gen server who calls grpc functions, it’s also my gen server who spawns gun

if anything from gun comes to my gen server before I call GRPC.Stub.recv (so gun:await under the hood), this message will be dropped by my handle_info

if messages come after I call GRPC.Stub.recv, everything is okay as Stub.recv is blocking and goes through the whole mailbox

Looks like GRPC.Stub.recv can’t be used in GenServers :thinking:

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews