locked
Can someone have any idea of how can I have SQL Timeout in about 50ms on Linq to SQL query RRS feed

  • Question

  • User-943250815 posted

    I have a Web Service (that is consumed) to just check in a single table if a RecID exist, there is a index for such column.
    It uses Linq To SQL query, where default connection timeout is 30 seconds.

    Web Service is working fine about a year, nothing changed on app or DB since then only number of records grow.

    Now I´m observing sometimes an exception "System.Data.SqlClient.SqlException: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.".
    It happens about once a week by 1~1.5 minute
    For log purposes I register start, end and elapsed time for each Web Service request, when Exception happens elapsed varies as 50ms, 100ms, 200ms
    How can this be possible?

    By the way IIS and SQL on same server

    I understand a timeout after 30 seconds, but in milliseconds.......
    Does anybody have any clue?

    Wednesday, March 20, 2019 11:22 PM

All replies

  • User1120430333 posted

    By the way IIS and SQL on same server

    You're doing the hosting yourself and the entire computer is being exposed to the public Internet? If so,  the computer has a very very strong possibility that it has been hacked with IIS and MS SQL Server having a strong possibility that they are compromised too.

    How can this be possible?

    Maybe some root kit is running on the computer and is uploading everything off of the computer at the time that things are timing out.

    If this is a Windows workstation version of the O/S not a server version  of the O/S with workstation version only having licensing for only 10 concurrent connections open on the O/S at any given time,  that 11th connection attempt  is out of luck and that could be a problem too. 

    It could be that some other program is running on the computer that has all the connections to SQL Server sucked up at the time of the time outs. Maybe, connection pooling is not being used properly by a program accessing MS SQL Server.

    It is just some things to think about.

    Thursday, March 21, 2019 5:11 AM
  • User-943250815 posted

    It should be exposed to public internet, but access is controlled by Origin IP Address on Firewall, and data received on request is checked/validated (format, content and values) before any action.  To prevent any bad request.
    So back to blackboard, any other suggestions?

    Thursday, March 21, 2019 4:26 PM
  • User1120430333 posted

    jzero

    It should be exposed to public internet, but access is controlled by Origin IP Address on Firewall, and data received on request is checked/validated (format, content and values) before any action.  To prevent any bad request.
    So back to blackboard, any other suggestions?

    and 

    What firewall? If the firewall is a host based firewall that is running with the O/S, then it can be fooled. If the Windows O/S, file system, registry, user accounts, and IIS have not been harden to attack, which there 1,000 page books covering this and the experts can hardly do it, for a machine hosting the Windows O/S that is exposed to the public Internet, then it is just hack bait sitting there waiting to be hacked,   And you have MS SQL Server on the same machine and IIS too. Come on man, it's a security nightmare.

    One other thing, an exploit can be dropped on that machine,  it can be running right in your face and you would never know it, becuase you don't know how to look for it. It fooled all your security measures firewall and all. 

    Thursday, March 21, 2019 4:43 PM
  • User-943250815 posted

    @DA924, sure I understand your point.
    There is an firewall appliance before server. A security issue could be one of many possibilites.
    Seems I´m not alone, found another guy with similar issue here https://stackoverflow.com/questions/24360513/sql-error-timeout-with-transaction and related thread
    https://stackoverflow.com/questions/1421978/help-troubleshooting-sqlexception-timeout-expired-on-connection-in-a-non-load

    Looks a Low Memory can cause a really faster timeout....


    Thursday, March 21, 2019 6:57 PM
  • User1120430333 posted

    @DA924, sure I understand your point.
    There is an firewall appliance before server. A security issue could be one of many possibilites.
    Seems I´m not alone, found another guy with similar issue here https://stackoverflow.com/questions/24360513/sql-error-timeout-with-transaction and related thread
    https://stackoverflow.com/questions/1421978/help-troubleshooting-sqlexception-timeout-expired-on-connection-in-a-non-load

    Looks a Low Memory can cause a really faster timeout....


    It's possible, but do you know what is actually running on the machine, because after all, programs use memory even ones with dubious intent. 

    Thursday, March 21, 2019 8:18 PM