Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Strange behaviour using library on Ubuntu server #1157

Closed
lukapor opened this issue Feb 23, 2021 · 3 comments
Closed

Strange behaviour using library on Ubuntu server #1157

lukapor opened this issue Feb 23, 2021 · 3 comments
Labels
question A question about how to do something

Comments

@lukapor
Copy link

lukapor commented Feb 23, 2021

Hi,

I am using library to sync mails for a some users. My code runs on ubuntu 20.04 (net5.0 application). We use only async implemetation.
When application starts, it runs sync task for few users (let say 10 users) and cpu raise high to 100%. If I run this on Windows server it is no problem.

I add some logs, but it seems that code stuck somewhere in network calls (never returns from ImapClient functions).
It could be something related to dotnet/runtime#44422

Regards, Luka

@jstedfast jstedfast added the question A question about how to do something label Feb 23, 2021
@jstedfast
Copy link
Owner

The Socket.SendAsync thread-safety thing shouldn't be an issue because you shouldn't be trying to invoke commands on the same ImapClient (or ImapFolder) from multiple threads. That's pretty much guaranteed to cause problems even if Socket.SendAsync() was thread-safe.

There's just no sane way to deal with that.

What more can you tell me? I'm leaning toward "if it works fine on Windows, then it's probably a .NET Core runtime bug on Linux"

Since you are using the Async APIs, then ImapStream.ReadAheadAsync should be using the ReadAsync method of the underlying stream rather than a hacky Poll() loop that runs when the synchronous API is used (which could cause a CPU spike if there were enough clients running concurrently).

@lukapor
Copy link
Author

lukapor commented Feb 24, 2021

Thx for response,

With thread-safety I agree.

I will compile library directly to my project and add some debug logs. I will let you know if i will discover something. I assume that something is cycling on reading from socket.

@lukapor
Copy link
Author

lukapor commented Mar 6, 2021

Hi,

when I run windows mashine on prod the problamatic imap account finished syncing, so I could not detect/trace the problem. As soon I got I new user with same problem I will debug issue and let you know.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question A question about how to do something
Projects
None yet
Development

No branches or pull requests

2 participants