Skip to content

Commit 565a4ad

Browse files
Crystal Jinfacebook-github-bot
Crystal Jin
authored andcommitted
Back out "exception_wrapper thrown variant via abi/runtime"
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
1 parent e0f29e1 commit 565a4ad

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

rsocket/test/transport/TcpDuplexConnectionTest.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,25 @@ TEST(TcpDuplexConnection, ConnectionAndSubscribersAreUntied) {
109109
worker.getEventBase());
110110
}
111111

112+
TEST(TcpDuplexConnection, ExceptionWrapperTest) {
113+
folly::AsyncSocketException socketException(
114+
folly::AsyncSocketException::AsyncSocketExceptionType::INVALID_STATE,
115+
"test",
116+
10);
117+
folly::SSLException sslException(5, 10, 15, 20);
118+
119+
const folly::AsyncSocketException& socketExceptionRef = sslException;
120+
121+
folly::exception_wrapper ex1(socketException);
122+
folly::exception_wrapper ex2(sslException);
123+
124+
// Slicing error:
125+
// folly::exception_wrapper ex3(socketExceptionRef);
126+
127+
// Fixed version:
128+
folly::exception_wrapper ex3(
129+
std::make_exception_ptr(socketExceptionRef), socketExceptionRef);
130+
}
131+
112132
} // namespace tests
113133
} // namespace rsocket

rsocket/transports/tcp/TcpDuplexConnection.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class TcpReaderWriter : public folly::AsyncTransportWrapper::WriteCallback,
109109

110110
void writeErr(size_t, const folly::AsyncSocketException& exn) noexcept
111111
override {
112-
closeErr(folly::exception_wrapper{folly::copy(exn)});
112+
closeErr(folly::exception_wrapper{std::make_exception_ptr(exn), exn});
113113
intrusive_ptr_release(this);
114114
}
115115

@@ -134,7 +134,7 @@ class TcpReaderWriter : public folly::AsyncTransportWrapper::WriteCallback,
134134
}
135135

136136
void readErr(const folly::AsyncSocketException& exn) noexcept override {
137-
closeErr(folly::exception_wrapper{folly::copy(exn)});
137+
closeErr(folly::exception_wrapper{std::make_exception_ptr(exn), exn});
138138
intrusive_ptr_release(this);
139139
}
140140

0 commit comments

Comments
 (0)