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

Can't reentrant(?) call in StreamingHub #866

Open
prisira opened this issue Oct 31, 2024 · 2 comments
Open

Can't reentrant(?) call in StreamingHub #866

prisira opened this issue Oct 31, 2024 · 2 comments

Comments

@prisira
Copy link

prisira commented Oct 31, 2024

Using MagicOnion 7.0.0-preview.10

In StreamingHub

Server <- Client
   |
   v
Server -> Client
            |
            v
Server <- Client
  No response returned here...

Would like to know if there is a plan to make this possible.

@mayuki
Copy link
Member

mayuki commented Nov 1, 2024

Is the server calling the client a broadcast or client results? Is it something like the following?
In any case, the Hub method processes in serial for the client, so if the Hub methods wait for each other, a deadlock will occur.

Client results

sequenceDiagram
    Client->>+Server: Invoke HubMethodA
    Server->>+Client: Invoke ClientMethodA
    Client->>+Server: Invoke HubMethodB
    Server-->>-Client: Return from HubMethodB
    Client-->>-Server: Return from ClientMethodA
    Server-->>-Client: Return from HubMethodA
Loading

Broadcast

sequenceDiagram
    Client->>+Server: Invoke HubMethodA
    Server->>+Client: OnBroadcastMethodA
    Server-->>-Client: Return from HubMethodA
    Client->>Server: Invoke HubMethodB
    Server-->>Client: Return from HubMethodB
Loading

@prisira
Copy link
Author

prisira commented Nov 1, 2024

Thank you for the detailed diagram.

Yes, the “Client Results” case is being used.
I see, a deadlock occurs when multiple duplex calls are made simultaneously.

In cases where the Client and Server need to communicate closely, this prevents the use of mechanisms like try/catch or a using scope, making the implementation much more complicated.
I would be very grateful if this could be improved.

And... If the Hub method processes are sequential, Then I realized there is a workaround using Task.Run in a method, but this method is challenging to use because it does not properly wait for the complete.

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