UnitySendMessage() Crashes with strings bigger than 1MB

オープン
#67 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
android, unity
領域
mobile-dev

調査の方向性

The report identifies mUnityPlayer.UnitySendMessage() and provides Android crash signals, but names no source file or test. Start by locating the Unity-to-Android override and tracing how it handles large strings; the reported failure occurs near 1 MB. Done means large strings can be delivered without crashing, with a regression test or reproducible verification for the reported size.

索引モデルが issue の本文から書いたものです。

説明

I am able to send any sizes of strings from Unity to AndroidStudio via override, but I get a crash you you try to send any string close or bigger than 1MB using the mUnityPlayer.UnitySendMessage() method.

This issue was very hard to track, after some debugging the maximum string length I could safely deliver was 1047500. (actually you can fit 1,048,576 characters on 1MB but anything above 1,047,500 may or not crash)
Since there is no fix to this and just one old comment on the forum... (yeah I've lost the link to that)

The workaround:
The way to get around it was to divide the strings into pieces of 1 million or less.
Upon sending the data to Unity I send a message (JSON) to a method saying how many parts it has.
Then I use a cached StringBuilder to append all the parts. Upon appending the last part I proceed with my usual code using the full string.

As this is a private project I will post just a part of the error:

E/CRASH: signal 7 (SIGBUS), code 2 (BUS_ADRERR), fault addr 0x88e07000

E/CRASH: main thread is trapped; signum = 7
E/CRASH: main thread is trapped; signum = 7

E/CRASH: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
E/CRASH: Cause: null pointer dereference
主要言語
Objective-C++
スター
815
フォーク
252
平均マージ
21時間 42分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Unity-Technologies/uaal-example のほかの issue

Unity-Technologies/uaal-example の issue をすべて見る

似ている issue

Mobile Dev の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。