#833 Wrong Period Assigned to Fact_Acct

Core
closed-accepted
9
2008-01-30
2007-10-26
No

To reproduce you require a second Client in addition to GardenWorld.

Using SuperUser login to GardenWorld.
Complete any invoice and note the Account Date.
Manually post the GLs using the *Post* button.
Logout [ not "Exit Application but Log Out!]

Now login to the new client (I used SuperUser again and select the newClientAdmin role).
Create an Invoice (I actually created a credit memo - so I didn't need to create a Sales Order first).
Ensure the Account Date is the same as was on the GW Invoice.
Add any line and complete.
Manually post the GLs using the *Post* button.

Now if you look in the Fact_Acct Table you will see the postings from the GardenWorld Invoice & those of the newClient Invoice are both to the same C_Period_ID even though they are in different clients!

The reason for this, I believe, is in the MPeriod.get() method the cache is checked first before reading the Periods from the DB but the if-clause in the iteration is only that the Account Date is within the period and there is no check of the Client.

Iterator it = s_cache.values().iterator();
while (it.hasNext())
{
MPeriod period = (MPeriod)it.next();
if (period.isStandardPeriod() && period.isInPeriod(DateAcct))
return period;
}

I think a simple addition here to check period.getAD_Client_ID = the context Client ID would resolve this. But it raises the possibility that other issues might arise around the caches perhaps it would be better if we could explicitly drop the cache when we logout?

The cache is not somethnig I have looked at before, so my next question is are there more caches used in the overall cache strategy that we should investigate?

While I think this would only effect users who have access multiple clients (I'm assuming the cache is per user & session - is that correct?), it is (as corruption of the account posting) a potentially serious problem so once confirmed I think should be assign this a priority 9.

what do others think?

colin

Discussion

  • Carlos Ruiz

    Carlos Ruiz - 2007-10-26

    Logged In: YES
    user_id=1180760
    Originator: NO

    Good catch Colin! Hard to find but really dangerous.

    1 - I suppose (but haven't tested or looked at) the Cache is being cleared when using LogOut

    2 - The posting is done in the server - so the server must be receiving wrong info from the caller

    3 - I'm not sure how this works - but theorizing it could be something like:
    - You open client and get a connection/session with the server for posting
    - When you make logout the connection/session is not released - so if you make a new posting it's using the old connection/session for the previous client

    Just guessing.

    Regards,

    Carlos Ruiz

     
  • Carlos Ruiz

    Carlos Ruiz - 2007-10-26
    • milestone: --> Core
    • priority: 5 --> 9
     
  • Colin Rooney

    Colin Rooney - 2007-10-26

    Logged In: YES
    user_id=1238223
    Originator: YES

    >> Good catch Colin! Hard to find but really dangerous.
    Actually it was a problem reported in the compiere forums by adaxa!
    So I can't take the credit. My bit is just assuming it's cache related.

    >>2 - The posting is done in the server
    Ah ok ... I had assumed when you press the manual post button then it happened in the client.
    This does make it more complex ok. But might explain how it occurs in compiere as I don't think they have our logout functionality!?

    I guess the additional check I suggest would get resolve this instance of the problem but I haven't tested it yet and it would only be a hack (although I think it would be correct anyway). I will invetigate the caching further ... I looked briefly but it seemed to be just a simple hashmap. I guess it's all down to the scope of the hashmap object determined by where the cache is created.

    thx for the input

    colin

     
  • Carlos Ruiz

    Carlos Ruiz - 2007-10-26

    Logged In: YES
    user_id=1180760
    Originator: NO

    Hmmm, that's even more strange.

    Compiere don't have the logout functionality - so there will be a problem of the session where you connects on the server not refreshing properly the client - even worst if it doesn't have as workaround to exit completely.

    Regards,

    Carlos Ruiz

     
  • Colin Rooney

    Colin Rooney - 2007-10-26

    Logged In: YES
    user_id=1238223
    Originator: YES

    I'd need to readup on this to be sure, but the cache used for the period s_cache is a private static instance of CCache (which is basically a HaspMap) ... from memory doesn't that mean it's valid for the life of the jvm? Are the jboss processes run within their own jvm or do they all run within the jboss jvm? I'm wondering is the accounting processor for each client running in their own jvm or do they share one provide by jboss? If they share doesn't that mean the same static s_cache exists & is shared by all of them? This is not something I've cosnidered in a long time I need to re-read my java books I think :) Can anybody same me some time :)

    colin

     
  • Trifon (An ADempiere founder)

    Logged In: YES
    user_id=195397
    Originator: NO

    Hi Colin,

    >Are the jboss processes run within their own jvm or do they all run
    >within the jboss jvm?

    I think and i'm sure that it run in the same JVM.

    >I'm wondering is the accounting processor for each
    >client running in their own jvm or do they share one provide by jboss?

    Share the JBoss VM.

    Kind regards,
    Trifon

     
  • Heng Sin

    Heng Sin - 2007-10-26

    Logged In: YES
    user_id=1599854
    Originator: NO

    Colin,

    The fact that this also happen in Compiere confirms that it is a server side problem. There are many things broken in Compiere's server side implementation, we have fixed many here and I believe is far ahead of Compiere now in this aspect. Looks like cache is another big issue that need to be resolved next.

    Regards,
    Low

     
  • Carlos Ruiz

    Carlos Ruiz - 2007-10-27
    • assigned_to: nobody --> croo
    • labels: --> Accounting
    • status: open --> pending-fixed
     
  • Carlos Ruiz

    Carlos Ruiz - 2007-10-27

    Logged In: YES
    user_id=1180760
    Originator: NO

    Hi Colin, solved, fixed in trunk with revision 3596 and mayday with revision 3597

    Regards,

    Carlos Ruiz

     
  • Carlos Ruiz

    Carlos Ruiz - 2007-10-27

    Logged In: YES
    user_id=1180760
    Originator: NO

    Excuse me Colin, I didn't read completely your request:

    > The cache is not somethnig I have looked at before, so my next
    > question is are there more caches used in the overall cache
    > strategy that we should investigate?

    Well, I researched all classes where CCache is used and found just two problems:

    * In MProductCategory I found a strange thing with the s_cache - it is never put.

    * In MUOM -> getMinute_UOM_ID you can find a select without client - it could represent a problem if you define a UOM with X12DE355=MJ for a client.

    Regards,

    Carlos Ruiz

     
  • Carlos Ruiz

    Carlos Ruiz - 2007-10-27
    • status: pending-fixed --> pending-accepted
     
  • Colin Rooney

    Colin Rooney - 2007-10-27
    • status: pending-accepted --> open-accepted
     
  • Colin Rooney

    Colin Rooney - 2007-10-27

    Logged In: YES
    user_id=1238223
    Originator: YES

    Thx all ... I will be away today so I won't get a chance to test and confirm but I justed wanted to acknowledge all your responses in case you thought I didn't care! :) thx!

    colin

     
  • Carlos Ruiz

    Carlos Ruiz - 2007-10-28
    • status: open-accepted --> pending-accepted
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • SourceForge Robot

    • status: pending-accepted --> closed-accepted
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks