Hi, few years back I had posted this question:
https://groups.google.com/a/chromium.org/g/chromium-dev/c/e1p_FvRpYtY/m/PXvo_hDgBAAJ Even though we are sending messages to extensions from our native messaging host sequentially, our native messaging host is still being terminated randomly on a few machines. We are using our own Chromium fork, while we can't replicate this issue on our machines but few users are affected by this bug randomly almost every day which is giving us a big problem right now.
To mitigate this issue, I have modified our fork to ignore messages greater than 1024*1024 from our specific extension only as shown below:
ProcessIncomingData method from src\chrome\browser\extensions\api\messaging\native_message_process_host.cc:
if (message_size > kMaximumNativeMessageSize) {
// Don't send exit signal to WM, as this bug could have bee
// by a bug in Chromium:
https://cloudfactory.atlassian.net if (source_extension_id_ .compare("ddmbapcgpfbnlhildjojbgcg
// Clear the buffer to prevent infinite loop and discard
incoming_data_.clear();
LOG(WARNING) <<
"Exit signal bug triggered in the WSB. This message wil
return;
}
LOG(ERROR) << "Native Messaging host tried sending a messag
<< message_size << " bytes long.";
Close(kHostInputOutputError);
return;
}
if (incoming_data_.size() < message_size + kMessageHeaderSize
return;
client_->PostMessageFromNativeHost(
incoming_data_.substr(kMessageHeaderSize, message_size));
in our test which we managed to do so by explicitly sending messages greater than 1 MB, it won't be terminated.
But our native messaging host won't send messages greater than 1 MB at all as we have designed it not to do so. Despite that it's being terminated stating that it was trying to send x length data where x is a random integer which specifies it's length, which we managed to find out by checking the log of one of our users.
So is there any other places where this termination happens besides shown above? I have been trying to find haven't been able to find till now.
Thanks