Error: Attempted to read past of the stream

Thread is closed for posting
2 posts, 0 answers
  1. Sandro
    Sandro avatar
    1 posts
    Member since:
    Oct 2012

    Posted 16 Sep 2014 Link to this post


    I'm developing a web application using a third party API (Visual Web Gui) and OpenAccess for the Database. The database I'm using is MySQL.

    I have a connection for each thread I use. If the website remains open for a period of time (let's say, 30 seconds), and the user does an action that requires a query to the database, I receive the "Attempted to read past of the stream" exception.

    After searching on the Internet, I've found that this exception is related to the timeout variables in the MySQL server (concretely, "net_write_timeout" and "net_read_timeout". The problem is that my host provider does not let me change those values.

    Is there any other way to solve this exception?

    Thank you in advance!
  2. Kristian Nikolov
    Kristian Nikolov avatar
    206 posts

    Posted 19 Sep 2014 Link to this post

    Hi Sandro,

    Thank you for contacting us.

    Generally the error you are experiencing is thrown by MySql because the respective timeouts have been exceeded. Usually this can be attributed to network connection issues. That being said the error could also be caused by other specifics of your scenario related to connection management. Therefore we would need some additional details, could you please answer the following questions:
    1. Could you clarify what is the exact connection setup you referred to?
    2. Does each thread use a separate context object to work with the database or are multiple threads using the same context object?
    3. Are the used context objects initialized and disposed per operation or are they used to execute multiple separate operations before disposing them (long living context)?
    4. Does this issue occur if you use a local instance of MySql?
    5. Could you provide us with the code that causes the exception to be thrown and a stack trace?

    This should allow us to gain better understanding of your scenario.

    We are looking forward to your feedback.

    Kristian Nikolov
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top