From reviews-return-91561-apmail-mesos-reviews-archive=mesos.apache.org@mesos.apache.org Tue Apr 7 22:05:19 2020 Return-Path: X-Original-To: apmail-mesos-reviews-archive@minotaur.apache.org Delivered-To: apmail-mesos-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by minotaur.apache.org (Postfix) with SMTP id 44AF8198FC for ; Tue, 7 Apr 2020 22:05:19 +0000 (UTC) Received: (qmail 49773 invoked by uid 500); 7 Apr 2020 22:05:18 -0000 Delivered-To: apmail-mesos-reviews-archive@mesos.apache.org Received: (qmail 49753 invoked by uid 500); 7 Apr 2020 22:05:18 -0000 Mailing-List: contact reviews-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@mesos.apache.org Delivered-To: mailing list reviews@mesos.apache.org Received: (qmail 49739 invoked by uid 99); 7 Apr 2020 22:05:18 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Apr 2020 22:05:18 +0000 From: GitBox To: reviews@mesos.apache.org Subject: [GitHub] [mesos] cf-natali commented on issue #356: libprocess: check protobuf (de)serialisation success. Message-ID: <158629711859.25229.16573006415361911393.gitbox@gitbox.apache.org> References: In-Reply-To: Date: Tue, 07 Apr 2020 22:05:18 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit cf-natali commented on issue #356: libprocess: check protobuf (de)serialisation success. URL: https://github.com/apache/mesos/pull/356#issuecomment-610643627 > This will only return false for the message being too large? Where do you see out of memory being handled? Agreed. I *thought* it would handle it, but it looks like it just lets `std::bad_alloc` propagate. > It also looks like invalid UTF-8 does not fail serialization, but rather only logs an error for "proto3" always and logs an error in debug mode for "proto2", see [this example of a proto3 message](https://github.com/protocolbuffers/protobuf/blob/v3.11.4/src/google/protobuf/any.pb.cc#L214). Indeed, it's a bit of a mess. Basically what happened in our case is that the framework re-serialises a subset of the messages received from the master into an event log, but uses proto3 - so serialisation would work, but then deserialising this would fail... It's a bit sad that with proto3 serialising invalid uft8 doesn't fail but deserialising fails, it's contrary to Postel's principle :). > I'm a little puzzled at how you saw the logging, is your libprotobuf using debug mode? Interesting - we actually build our own libprotobuf - I'll ask our IT to double-check. > **Serialization of invalid UTF-8**: > > * "proto3": serialization will succeed but invalid UTF-8 will be logged. > > * "proto2": serialization will succeed. Invalid UTF-8 will only be logged in debug mode (NDEBUG not defined). > > > **De-serialization of invalid UTF-8**: > > * "proto3": de-serialization will fail and it will be logged. > > * "proto2": de-serialization will succeed. Invalid UTF-8 will only be logged in debug mode (NDEBUG not defined). Yes, it also matches my testing. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services