What is stale state?

31.6k Views Asked by At

I was reading about the object pool pattern on Wikipedia (http://en.wikipedia.org/wiki/Object_pool) and it mentions "dangerously stale state".

What exactly is "stale" state? I know state is variables/data, such as my fields and properties, but what does it mean by stale or dangerously stale?

5

There are 5 best solutions below

0
On BEST ANSWER

Stale state is information in an object that does not reflect reality.

Example: an object's members are filled with information from a database, but the underlying data in the database has changed since the object was filled.

Dangerously stale state is stale state that might adversely affect the operation of a program, i.e. causing it to perform incorrectly due to invalid assumptions about the data's integrity.

0
On

It happens when the value stored in the object does not anymore reflect the underlying persistent value. I guess dangerously stale is just a way to say that the value is really outdated.

0
On

Basically, it means invalid state. Usually a by-product of not notifying your instances of state change.

0
On

"Stale state" is when an object's stored (cached) view of the rest of the system becomes out of date. Eg an object is holding a handle to some other object, but the second object has been deleted in the meantime.

Trying to dereference a stale handle can lead to big problems.

Most systems will try to automagically protect you from various reasons for ending up with stale state, but it is not always possible to cover every case. (Depending on the system.)

Larry

0
On

In the context of SQL, a stale state refers to a situation where a database query returns outdated or inconsistent data. This can occur when multiple transactions are trying to modify the same data simultaneously, leading to a temporary mismatch in the information stored in the database. This can result in data that is not up-to-date and therefore considered "stale". To prevent stale data, database systems typically use locking mechanisms or transaction isolation levels to ensure that data remains consistent and up-to-date.