Code Monkey home page Code Monkey logo

Comments (10)

smiley22 avatar smiley22 commented on July 20, 2024

Thanks,

I will look into it and see if I can find out what's going on.

from s22.imap.

vchernyshev avatar vchernyshev commented on July 20, 2024

Thank you!

OOM could be thrown by another reason for sure, but it was thrown on
GetResponse method of ImapClient
on the following line:

mem.WriteByte(b);
Thanks,
Victor

On Wed, Nov 28, 2012 at 5:30 PM, smiley22 [email protected] wrote:

Thanks,

I will look into it and see if I can find out what's going on.


Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-10797645.

from s22.imap.

vchernyshev avatar vchernyshev commented on July 20, 2024

I've found it. At some point server closes connection and an exception is thrown from GetResponse.
It starts cycling infinitely (hitting GetResponse method upto 6K times per second).

while (true) {
                try {
                    string response = GetResponse();
                    /* A request was made to stop idling so quit the thread */
                    if (response.Contains("OK IDLE"))
                        return;
                    /* Let the dispatcher thread take care of the IDLE notification so we
                     * can go back to receiving responses */
                    idleEvents.Enqueue(response);
                } catch (IOException) {
                    /* Closing _Stream or the underlying _Connection instance will
                     * cause a WSACancelBlockingCall exception on a blocking socket.
                     * This is not an error so just let it pass.
                     */
                }
            }

from s22.imap.

smiley22 avatar smiley22 commented on July 20, 2024

Ah okay so that's what it is, good job! I'll try to come up with a fix asap.

cheers,
smiley22

On Thu, Nov 29, 2012 at 5:15 AM, vchernyshev [email protected]:

I've found it. At some point server closes connection and an exception is
thrown from GetResponse.
It starts cycling infinitely (hitting GetResponse method upto 6K times per
second).

while (true) {
try {
string response = GetResponse();
/* A request was made to stop idling so quit the thread /
if (response.Contains("OK IDLE"))
return;
/
Let the dispatcher thread take care of the IDLE notification so we
* can go back to receiving responses /
idleEvents.Enqueue(response);
} catch (IOException) {
/
Closing _Stream or the underlying _Connection instance will
* cause a WSACancelBlockingCall exception on a blocking socket.
* This is not an error so just let it pass.
*/
}
}


Reply to this email directly or view it on GitHubhttps://github.com//issues/20#issuecomment-10834503.

from s22.imap.

smiley22 avatar smiley22 commented on July 20, 2024

There's not much you can do when the server closes the connection, I guess it's best to just let the exception bubble up in this case. This is a pretty delicate part of the library and I want to make sure the changes are really bullet-proof, so feel free to give some feedback.

        while (true) {
            try {
                string response = GetResponse();
                /* A request was made to stop idling so quit the thread */
                if (response.Contains("OK IDLE"))
                    return;
                /* Let the dispatcher thread take care of the IDLE notification so we
                 * can go back to receiving responses */
                idleEvents.Enqueue(response);
            } catch (IOException e) {
                /* Closing _Stream or the underlying _Connection instance will
                 * cause a WSACancelBlockingCall exception on a blocking socket.
                 * This is not an error so just let it pass.
                 */
                if (e.InnerException is SocketException) {
                    /* WSAEINTR = 10004 */
                    if (((SocketException)e.InnerException).ErrorCode == 10004)
                        return;
                }
                /* If the IO exception was raised because of an underlying
                 * ThreadAbortException, we can ignore it. */
                if (e.InnerException is ThreadAbortException)
                    return;
                /* Otherwise let it bubble up */
                throw;
            }
        }

from s22.imap.

vchernyshev avatar vchernyshev commented on July 20, 2024

Thank you for the fix. One question though. What is best place to catch this bubbled exception?

from s22.imap.

vchernyshev avatar vchernyshev commented on July 20, 2024

Hello! I'm still getting OutOfMemory Exception on
private string GetResponse(bool resolveLiterals = true)
...
in mem.WriteByte(b);

from s22.imap.

smiley22 avatar smiley22 commented on July 20, 2024

okay thanks, will take another look at it

from s22.imap.

zadj avatar zadj commented on July 20, 2024

I have also seen an out of memory error in the GetResponse method.

The set-up when the error happens is that the call to the ImapClient constructor passed in useSSL = false and a port number of 993. The hostname was set to "outlook.office365.com". Fixing the useSSL to be true stopped the error.

Hope this helps.

from s22.imap.

smiley22 avatar smiley22 commented on July 20, 2024

I guess it'd be better to catch the exception in IdleLoop and raise some sort of error event..

from s22.imap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.