openimsdk / open-im-sdk-flutter

IM SDK Flutter
https://openim.io
MIT License
362 stars 226 forks source link

[BUG] PlatformException (PlatformException(10005, error *errors.withStack not implement CodeError: GetFriendList failed: disk I/O error: read-only file system, null, null)) #152

Closed fatesinger closed 1 week ago

fatesinger commented 3 weeks ago

Describe the bug

When there is too much conversation messages, calling conversationManager.getConversationListSplit will report an error. image

How to reproduce

Steps to reproduce the behavior:

Use open-im-flutter-demo

  1. Create 1,000 group conversation messages.
  2. After synchronization.
  3. Kill the app process and re-enter.
  4. Go to conversation.
  5. Scroll to the bottom.
  6. Scroll again.
  7. When offset is 320.
  8. Error occurred.

Expected behavior

Conversation messages are loaded correctly

Screenshots (If contains)

image

Version information

Additional context

std-s commented 3 weeks ago

Hi, set count to a smaller value. For example, 50, 100.

fatesinger commented 3 weeks ago

Now the count is 40. I changed the count to 20, but the problem still remains.

final pageSize = 20;

void onLoading() async {
  late List<ConversationInfo> list;
  try {
    list = await _request(this.list.length);
    this.list.addAll(list);
  } finally {
    if (list.isEmpty || list.length < pageSize) {
      refreshController.loadNoData();
    } else {
      refreshController.loadComplete();
    }
  }
}

_request(int offset) =>
    OpenIM.iMManager.conversationManager.getConversationListSplit(
      offset: offset,
      count: pageSize,
    );
std-s commented 3 weeks ago

The function reporting the error is "getFriendList".

fatesinger commented 3 weeks ago

Please try this code.


List list = [];
final pageSize = 50;

getConversationList(int offset) async {
  var list = await OpenIM.iMManager.conversationManager.getConversationListSplit(
    offset: offset,
    count: pageSize,
  );
  return list;
}

FloatingActionButton(
  onPressed: () async {
    var result = await getConversationList(400);
    setState(() {
      list = result;
    });
  },
)

image

std-s commented 3 weeks ago

Let’s follow up on this issue.