Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

when calling clear of LazyArrayList, there is an exception "this.loadedSegments" is null #584

Closed
yqbjtu opened this issue May 29, 2023 · 1 comment · Fixed by #586
Closed
Assignees
Labels
bug Something isn't working

Comments

@yqbjtu
Copy link

yqbjtu commented May 29, 2023

Environment Details

  • MicroStream Version:8.0
  • JDK version:17
  • OS:Mac
  • Used springboot 2.6.8

Describe the bug

I used LazyArrayList to store some data. My dataRoot like this

class DataRoot {
Map<String, LazyArrayList> mapList

}

When some key is not needed, I'll clear the list and store list , remove the key from mapList and storing mapList.

To Reproduce

1, store 10 keys to mapList
2, close storage
3, open storage
4, clear the list

exception:
2023-05-27 17:23:51,015 ERROR a.m.o.c.base.PListContainer.writeOp [http-nio-80-exec-10] Error while writing value, errMsg:Cannot invoke "java.util.LinkedList.remove(Object)" because "this.loadedSegments" is null
java.lang.NullPointerException: Cannot invoke "java.util.LinkedList.remove(Object)" because "this.loadedSegments" is null
at one.microstream.collections.lazy.LazySegmentUnloader$Default.remove(LazySegmentUnloader.java:176)
at one.microstream.collections.lazy.LazyArrayList.clear(LazyArrayList.java:559)

Expected behavior

The list is cleared and no exception

Screenshots

Additional context

Add any other context about the problem here.

hg-ms added a commit that referenced this issue Jun 12, 2023
Fixed a Nullpointer exception in one.microstream.collections.lazy.LazySegmentUnloader.remove in case of no loaded segments.
@hg-ms hg-ms linked a pull request Jun 12, 2023 that will close this issue
@hg-ms hg-ms added the bug Something isn't working label Jun 12, 2023
@hg-ms hg-ms self-assigned this Jun 12, 2023
@hg-ms
Copy link
Contributor

hg-ms commented Jun 12, 2023

Bug Confirmed.
If clear is called after an LazyArrayList has been loaded from the storage the segment unloader does not check if the internal list of loaded segments is null.

hg-ms added a commit that referenced this issue Jun 16, 2023
Fixed a Nullpointer exception in one.microstream.collections.lazy.LazySegmentUnloader.remove in case of no loaded segments.
zdenek-jonas pushed a commit that referenced this issue Jul 4, 2023
Fixed a Nullpointer exception in one.microstream.collections.lazy.LazySegmentUnloader.remove in case of no loaded segments.

(cherry picked from commit f036cb5)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants