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

  • Home
  • SEARCH
  • 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 7429399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:57:56+00:00 2026-05-29T08:57:56+00:00

I have a bug I’ve been trying to track down for a few weeks

  • 0

I have a bug I’ve been trying to track down for a few weeks now, and have pretty much isolated exactly what’s going wrong. However, why this happens is beyond me.

I have a very large Oracle package (around 4,100 lines of code) and I’m calling several procedures. However, data seems to be getting lost between procedure calls.

The data that is being lost is:

dpmethodstate varchar_state_local_type;

First, I call this procedure:

PROCEDURE delivery_plan_set_state (
   messages OUT ReferenceCursor,
   state IN varchar_state_local_type
) AS
BEGIN
   logMessage('state COUNT is: ' || state.COUNT);
   dpmethodstate := state;
   FOR I IN 1..dpmethodstate.COUNT LOOP
      logMessage(dpmethodstate(I));
   END LOOP;
   logMessage('delivery_plan_set_state end - dpmethodstate count is now ' || dpmethodstate.COUNT);
   OPEN messages FOR SELECT * FROM TABLE(messageQueue);
   messageQueue := NULL;
END delivery_plan_set_state;

I pass in state, which is a valid array of a single string. I can verify in the logs that dpmethodstate has a COUNT of 1 when the procedure ends.

Next, I call the execute_filter procedure which looks like this:

PROCEDURE execute_filter (
   --Whole bunch of OUT parameters
) AS
--About 50 different local variables being set here
BEGIN
   SELECT TO_CHAR(SYSTIMESTAMP, 'HH24:MI:SS.ff') INTO TIMING FROM DUAL;
   logMessage('[' || TIMING || '] execute_filter begin');
   logMessage('a) dpmethodstate Count is: ' || dpmethodstate.COUNT);

   --Rest of procedure

However, this time dpmethodstate.COUNT is 0. The value I set from delivery_plan_set_state has vanished!

When I look at my logs, it looks something like this:

proposed
delivery_plan_set_state end - dpmethodstate count is now 1
[21:39:48.719017] execute_filter begin
a) dpmethodstate Count is: 0

As you can see, dpmethodstate got lost between procedure calls. There’s a few things to note:

  1. Nothing else in this package is capable of setting the value for dpmethodstate besides delivery_plan_set_state. And I can see nothing else has called it.
  2. My client side code is written in C#, and not much happens between the two procedure calls.
  3. This happens perhaps 1 out of every 100 times, so it’s very difficult to track down or debug.

First off, what’s the best way to debug a problem like this? Is there any more logging I can do? Also, how does Oracle maintain state between procedure calls and is there anything that can intermittently reset this state? Any pointers would be much appreciated!

  • 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-29T08:57:58+00:00Added an answer on May 29, 2026 at 8:57 am

    Is dpmethodstate a package global variable? I’m assuming it is, but I don’t see that explicitly mentioned.

    Since package global variables have session scope, are you certain that the two procedure calls are always using the same physical database connection and that nothing is using this connection in the interim? If you’re using some sort of connection pool where you get a connection from the pool before each call and return the connection to the pool after the first call, it wouldn’t be terribly unusual in a development environment (or low usage environment) to get the same connection 99% of the time for the second call but get a different session 1% of the time.

    Can you log the SID and SERIAL# of the session where you are setting the value and where you are retrieving the value?

    SELECT sid, serial#
      FROM v$session
     WHERE sid = sys_context( 'USERENV', 'SID' );
    

    If those are different, you wouldn’t expect the value to persist.

    Beyond that, there are other ways to clear session state but they require someone to take explicit action. Calling DBMS_SESSION.RESET_PACKAGE or DBMS_SESSION.MODIFY_PACKAGE_STATE(DBMS_SESSION.REINITIALIZE) will clear out any session state set in your session. Compiling the package will do the same thing but that should throw an error warning you that your session state was discarded when you try to read it.

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

Sidebar

Related Questions

I have a bug I'm struggling to track down. I believe what's happening is
I have an emergent bug that I've got to track down tomorrow. I know
I have a jquery bug and I've been looking for hours now, I can't
i have a bug i'm trying to narrow down and it's proving to be
I have a bug in IE8 when trying to get a property from css
We have a bug that we are trying to fix. It looks like one
We have a bug we're trying to find that happens non-deterministically (well, it's deterministic,
I have bug checked this code considerably now and made sure I am outputting
I notice that a lot of layouts on the internet now have this bug.
I have this bug in Obj-C that is caused because the program is trying

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.