Skip to content

Commit ebea693

Browse files
committed
Fixed uncaught exception in TS3FileWriteActor
1 parent 2ef3c19 commit ebea693

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

ydb/library/yql/providers/s3/actors/yql_s3_write_actor.cpp

+7-11
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class TS3FileWriteActor : public TActorBootstrapped<TS3FileWriteActor> {
139139
const TString& token)
140140
: TxId(txId)
141141
, Gateway(std::move(gateway))
142-
, Credentials(std::move(crdentials))
142+
, AuthInfo(crdentials.GetAuthInfo())
143143
, RetryPolicy(retryPolicy)
144144
, ActorSystem(TActivationContext::ActorSystem())
145145
, Key(key)
@@ -155,22 +155,21 @@ class TS3FileWriteActor : public TActorBootstrapped<TS3FileWriteActor> {
155155
void Bootstrap(const TActorId& parentId) {
156156
ParentId = parentId;
157157
LOG_D("TS3FileWriteActor", "Bootstrap by " << ParentId << " for Key: [" << Key << "], Url: [" << Url << "], request id: [" << RequestId << "]");
158-
auto authInfo = Credentials.GetAuthInfo();
159158
if (DirtyWrite && Parts->IsSealed() && Parts->Size() <= 1) {
160159
Become(&TS3FileWriteActor::SinglepartWorkingStateFunc);
161160
const size_t size = Max<size_t>(Parts->Volume(), 1);
162161
InFlight += size;
163162
SentSize += size;
164163
Gateway->Upload(Url,
165-
IHTTPGateway::MakeYcHeaders(RequestId, authInfo.GetToken(), {}, authInfo.GetAwsUserPwd(), authInfo.GetAwsSigV4()),
164+
IHTTPGateway::MakeYcHeaders(RequestId, AuthInfo.GetToken(), {}, AuthInfo.GetAwsUserPwd(), AuthInfo.GetAwsSigV4()),
166165
Parts->Pop(),
167166
std::bind(&TS3FileWriteActor::OnUploadFinish, ActorSystem, SelfId(), ParentId, Key, Url, RequestId, size, std::placeholders::_1),
168167
true,
169168
RetryPolicy);
170169
} else {
171170
Become(&TS3FileWriteActor::MultipartInitialStateFunc);
172171
Gateway->Upload(Url + "?uploads",
173-
IHTTPGateway::MakeYcHeaders(RequestId, authInfo.GetToken(), {}, authInfo.GetAwsUserPwd(), authInfo.GetAwsSigV4()),
172+
IHTTPGateway::MakeYcHeaders(RequestId, AuthInfo.GetToken(), {}, AuthInfo.GetAwsUserPwd(), AuthInfo.GetAwsSigV4()),
174173
0,
175174
std::bind(&TS3FileWriteActor::OnUploadsCreated, ActorSystem, SelfId(), ParentId, RequestId, std::placeholders::_1),
176175
false,
@@ -367,9 +366,8 @@ class TS3FileWriteActor : public TActorBootstrapped<TS3FileWriteActor> {
367366
Tags.emplace_back();
368367
InFlight += size;
369368
SentSize += size;
370-
auto authInfo = Credentials.GetAuthInfo();
371369
Gateway->Upload(Url + "?partNumber=" + std::to_string(index + 1) + "&uploadId=" + UploadId,
372-
IHTTPGateway::MakeYcHeaders(RequestId, authInfo.GetToken(), {}, authInfo.GetAwsUserPwd(), authInfo.GetAwsSigV4()),
370+
IHTTPGateway::MakeYcHeaders(RequestId, AuthInfo.GetToken(), {}, AuthInfo.GetAwsUserPwd(), AuthInfo.GetAwsSigV4()),
373371
std::move(part),
374372
std::bind(&TS3FileWriteActor::OnPartUploadFinish, ActorSystem, SelfId(), ParentId, size, index, RequestId, std::placeholders::_1),
375373
true,
@@ -395,9 +393,8 @@ class TS3FileWriteActor : public TActorBootstrapped<TS3FileWriteActor> {
395393
for (const auto& tag : Tags)
396394
xml << "<Part><PartNumber>" << ++i << "</PartNumber><ETag>" << tag << "</ETag></Part>" << Endl;
397395
xml << "</CompleteMultipartUpload>" << Endl;
398-
auto authInfo = Credentials.GetAuthInfo();
399396
Gateway->Upload(Url + "?uploadId=" + UploadId,
400-
IHTTPGateway::MakeYcHeaders(RequestId, authInfo.GetToken(), "application/xml", authInfo.GetAwsUserPwd(), authInfo.GetAwsSigV4()),
397+
IHTTPGateway::MakeYcHeaders(RequestId, AuthInfo.GetToken(), "application/xml", AuthInfo.GetAwsUserPwd(), AuthInfo.GetAwsSigV4()),
401398
xml,
402399
std::bind(&TS3FileWriteActor::OnMultipartUploadFinish, ActorSystem, SelfId(), ParentId, Key, Url, RequestId, SentSize, std::placeholders::_1),
403400
false,
@@ -412,9 +409,8 @@ class TS3FileWriteActor : public TActorBootstrapped<TS3FileWriteActor> {
412409
return;
413410
}
414411

415-
auto authInfo = Credentials.GetAuthInfo();
416412
Gateway->Delete(Url + "?uploadId=" + UploadId,
417-
IHTTPGateway::MakeYcHeaders(RequestId, authInfo.GetToken(), "application/xml", authInfo.GetAwsUserPwd(), authInfo.GetAwsSigV4()),
413+
IHTTPGateway::MakeYcHeaders(RequestId, AuthInfo.GetToken(), "application/xml", AuthInfo.GetAwsUserPwd(), AuthInfo.GetAwsSigV4()),
418414
std::bind(&TS3FileWriteActor::OnMultipartUploadAbort, ActorSystem, SelfId(), TxId, RequestId, std::placeholders::_1),
419415
RetryPolicy);
420416
UploadId.clear();
@@ -425,7 +421,7 @@ class TS3FileWriteActor : public TActorBootstrapped<TS3FileWriteActor> {
425421

426422
const TTxId TxId;
427423
const IHTTPGateway::TPtr Gateway;
428-
const TS3Credentials Credentials;
424+
const TS3Credentials::TAuthInfo AuthInfo;
429425
const IHTTPGateway::TRetryPolicy::TPtr RetryPolicy;
430426

431427
TActorSystem* const ActorSystem;

ydb/tests/tools/kqprun/kqprun.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,19 @@ void RunMain(int argc, const char* argv[]) {
232232
RunScript(executionOptions, runnerOptions);
233233
}
234234

235+
void KqprunTerminateHandler() {
236+
NColorizer::TColors colors = NColorizer::AutoColors(Cerr);
237+
238+
Cerr << colors.Red() << "======= terminate() call stack ========" << colors.Default() << Endl;
239+
FormatBackTrace(&Cerr);
240+
Cerr << colors.Red() << "=======================================" << colors.Default() << Endl;
241+
242+
abort();
243+
}
235244

236245
int main(int argc, const char* argv[]) {
246+
std::set_terminate(KqprunTerminateHandler);
247+
237248
try {
238249
RunMain(argc, argv);
239250
} catch (...) {

0 commit comments

Comments
 (0)