https://bugs.kde.org/show_bug.cgi?id=379669

--- Comment #50 from Igor Kushnir <igor...@gmail.com> ---
I rarely experience freeze on exit and even more rarely this particular freeze
(lately, once a year perhaps despite heavy KDevelop use). Yesterday I got the
currentIndex=0 freeze. Note the `followerIndex (index=0,` part in the following
call stack extract:

0x00007fbfc51630dd in KDevelop::Bucket<KDevelop::AbstractTypeData,
KDevelop::AbstractTypeDataRequest, true, 0u>::followerIndex (index=0,
this=<optimized out>) at
/path/to/kdevelop/kdevplatform/serialization/itemrepository.h:1070
1070            return *reinterpret_cast<unsigned short*>(m_data + (index -
2));
#0  0x00007fbfc51630dd in KDevelop::Bucket<KDevelop::AbstractTypeData,
KDevelop::AbstractTypeDataRequest, true, 0u>::followerIndex (index=0,
this=<optimized out>) at
/path/to/kdevelop/kdevplatform/serialization/itemrepository.h:1070
#1  KDevelop::Bucket<KDevelop::AbstractTypeData,
KDevelop::AbstractTypeDataRequest, true,
0u>::deleteItem<KDevelop::ItemRepository<KDevelop::AbstractTypeData,
KDevelop::AbstractTypeDataRequest, true, QRecursiveMutex, 0u, 1048576u> >
(repository=<optimized out>, hash=<optimized out>, index=44482,
this=0x7fbf0cbc5ad0) at
/path/to/kdevelop/kdevplatform/serialization/itemrepository.h:628
#2  KDevelop::Bucket<KDevelop::AbstractTypeData,
KDevelop::AbstractTypeDataRequest, true,
0u>::finalCleanup<KDevelop::ItemRepository<KDevelop::AbstractTypeData,
KDevelop::AbstractTypeDataRequest, true, QRecursiveMutex, 0u, 1048576u> >
(repository=<optimized out>, this=<optimized out>) at
/path/to/kdevelop/kdevplatform/serialization/itemrepository.h:791

KDevelop occupied a CPU core by the infinite loop `while (currentIndex !=
index)` for half an hour, until I terminated the KDevelop process. I verified
this by comparing GDB call stacks generated with the half-hour interval: all
addresses and arguments are exactly the same, until the line
itemrepository.h:626 in one and itemrepository.h:628 in another call stack.
These two line numbers correspond to the source code lines `while (currentIndex
!= index) {` and `currentIndex = followerIndex(currentIndex);` (inside the
loop) respectively.

1.5 years ago I got this same freeze after a blackout and consequently a sudden
system shutdown in KDevelop::Bucket<Utils::SetNodeData,
Utils::SetNodeDataRequest, false, 24u>, that is, probably because of cache
corruption.

Yesterday I repeatedly removed and installed kdev-python, KDevelop parsing of a
.py file hanged and I was forced to restart KDevelop. The freeze in
KDevelop::Bucket<KDevelop::AbstractTypeData, KDevelop::AbstractTypeDataRequest,
true, 0u> occurred during the next exit of the same KDevelop session. So again
it is a consequence of either missing language plugin or a related cache
corruption.

I think that due to performance considerations cache corruption inevitably
leads to undefined behavior. If the undefined behavior often manifests in the
same freeze, then we can try to work it around. An acceptable workaround should
be able to at least sometimes solve the problem automatically, possibly by
clearing the cache automatically or *insisting* that the user agrees to clear
the cache. Obviously no workaround can be 100% reliable in the face of
undefined behavior.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to