Skip to content

Commit

Permalink
Back out "exception_wrapper thrown variant via abi/runtime"
Browse files Browse the repository at this point in the history
Summary: D26331579 (b286305) was the offending diff that caused an insta crash on Messenger Android and Instagram Android. Backing out for now.

Reviewed By: JunqiWang

Differential Revision: D28308563

fbshipit-source-id: 87a547d9ba7cb3b33a4ddee9e273943f8379d990
  • Loading branch information
Crystal Jin authored and facebook-github-bot committed May 8, 2021
1 parent e0f29e1 commit 565a4ad
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions rsocket/test/transport/TcpDuplexConnectionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,25 @@ TEST(TcpDuplexConnection, ConnectionAndSubscribersAreUntied) {
worker.getEventBase());
}

TEST(TcpDuplexConnection, ExceptionWrapperTest) {
folly::AsyncSocketException socketException(
folly::AsyncSocketException::AsyncSocketExceptionType::INVALID_STATE,
"test",
10);
folly::SSLException sslException(5, 10, 15, 20);

const folly::AsyncSocketException& socketExceptionRef = sslException;

folly::exception_wrapper ex1(socketException);
folly::exception_wrapper ex2(sslException);

// Slicing error:
// folly::exception_wrapper ex3(socketExceptionRef);

// Fixed version:
folly::exception_wrapper ex3(
std::make_exception_ptr(socketExceptionRef), socketExceptionRef);
}

} // namespace tests
} // namespace rsocket
4 changes: 2 additions & 2 deletions rsocket/transports/tcp/TcpDuplexConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class TcpReaderWriter : public folly::AsyncTransportWrapper::WriteCallback,

void writeErr(size_t, const folly::AsyncSocketException& exn) noexcept
override {
closeErr(folly::exception_wrapper{folly::copy(exn)});
closeErr(folly::exception_wrapper{std::make_exception_ptr(exn), exn});
intrusive_ptr_release(this);
}

Expand All @@ -134,7 +134,7 @@ class TcpReaderWriter : public folly::AsyncTransportWrapper::WriteCallback,
}

void readErr(const folly::AsyncSocketException& exn) noexcept override {
closeErr(folly::exception_wrapper{folly::copy(exn)});
closeErr(folly::exception_wrapper{std::make_exception_ptr(exn), exn});
intrusive_ptr_release(this);
}

Expand Down

0 comments on commit 565a4ad

Please sign in to comment.