Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6842383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:05:37+00:00 2026-05-27T00:05:37+00:00

Every few months a few select pages of a website will start responding with

  • 0

Every few months a few select pages of a website will start responding with

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

I ran SQL Server Profiler to see where the database is getting hung up. It’s on a specific stored procedure. So I took the stored procedure call and ran it through Management Studio. Returns a few thousand rows in under a second.

Opening up the procedure, I see it’s just a simple select statement. If I take the select statement out and run it in a new query window, Management Studio will hang.

So I start running it in pieces, and find the line that’s causing the query to hang

and GetDate() between EffectiveDate and ISNULL(ExpiryDate, @CurrentDate) 

GetDate() is supposed to be @CurrentDate anyways, so if I switch it, it’ll run fine. Why does this even matter though? As I understand, GetDate should not be an expensive call. I understand IsNull is, but that shouldn’t matter either, as it can handle the query fine if I just swap out GetDate with CurrentDate.

Am I correct in assuming getdate is causing this query to hang intermittently? How/why would it do that?

A bit of background, as I said this error has popped up before, on March 23rd, July 27th, October 25th and now November 21st. It always seems to happen near the end of the month. I’ve been assured nothing is going on during this time (scheduled tasks, maintenance, etc.)

This is on a production server, so I haven’t been able to actually take the time to debug the problem. As soon as the site goes down, it has to be brought back up. I know how to fix it, I just need to force a recompile on the stored procedure, but does anyone have any idea what could be causing this?

The SQL Server also has another UAT database, the same procedure will hang on that database as well. But other stored procedures that have that exact same line of code run fine on both databases.

Edit: I had to put the website back up, so I recompiled the stored procedure. The site now runs fine. The query still doesn’t run on it’s own though.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:05:38+00:00Added an answer on May 27, 2026 at 12:05 am

    I was mistaken to the cause of the issue. The query I was running in pieces was basically:

    select *
    from Item
    left outer join category Subcategories on Subcategories.ItemKey = Item.Id,
    Categories Category,
    Availability
    where Item.Id = @ItemId
      and GetDate() between Availability.EffectiveDate 
          and ISNULL(Availability.ExpiryDate, @CurrentDate) 
    

    This obviously is not the query being run in production, just an anonymized example.

    This query would not run. To get it to run I originally commented out

    and GetDate() between EffectiveDate and ISNULL(ExpiryDate, @CurrentDate)

    It would also run if I changed GetDate() to @CurrentDate. I was sure GetDate was the problem. However, when I ran the query and commented out the Availablity line it worked fine. Availability is a massive table. I ran a re-index and a statistics update and everything works fine. I guess I owe GetDate an apology.

    Edit: This happened again on a completely different environment. Again GetDate appears to have been the culprit. Changing that line and running the procedure got everything to work again. GetDate may not be to blame as the root cause, but it’s definitely the first sign that something is going wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What are C macros useful for? Every few months I get an
I have a loop which basically calls this every few seconds (after the timeout):
I will release my GAE application in a few months on a closed beta
I have a website that was launched a few months ago. I would like
Every few months I find myself needing to call Win32 from C#. Though I've
Every time this situation pops up, which is about once every few months, I
One error I stumble upon every few month is this one: double x =
Every few days, google apps starts rejecting my username and password with : SMTPAuthenticationError:
As a programmer I make revolutionary findings every few years. I'm either ahead of
I need to automate an IM client to update a status every few hours,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.