clearer logging on fatal errors when stack traces are not available

This commit is contained in:
Eric 2023-06-08 11:43:45 -07:00
parent 44e284c01a
commit 9bc672605d
No known key found for this signature in database
GPG Key ID: 89C93F0F8D6D5A98
9 changed files with 79 additions and 76 deletions

56
.efrocachemap generated
View File

@ -4072,26 +4072,26 @@
"build/assets/workspace/ninjafightplug.py": "https://files.ballistica.net/cache/ba1/c5/09/4f10b8a21ba87aa5509cff7a164b",
"build/assets/workspace/onslaughtplug.py": "https://files.ballistica.net/cache/ba1/ff/0a/a354984f9c074dab0676ac7e4877",
"build/assets/workspace/runaroundplug.py": "https://files.ballistica.net/cache/ba1/2a/1c/9ee5db6d1bceca7fa6638fb8abde",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/02/08/b2319162d3e45bdbf9b6e60157c8",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/e1/a7/7bd6d0e731eb831b298a4400b835",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d4/b1/e6023d13f8d5e90fe9541a290e4b",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/3a/52/3e0cd585d0d6739b01fe8ec9032e",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/50/c8/52c1f1c8467ea32056df8928e046",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/a8/2e/3a4b6faa127cf64ab8a7760433e7",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d1/57/9ae52124b55a6b1f3f5f4cba7216",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/64/5b/fc659b6628076b67f491ca62b174",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/3f/4d/9711985938fb8bd5041dc55de46e",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/19/3d/c3a7f04293dae053b57fe06ffe3e",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/69/56/cc294914a71932cb75beb2bb3094",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/9e/3c/7804a6c319e322f77135f24999e8",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/a7/4e/a64a4b500335fcdb8ae460a60416",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/d4/b6/b62a890f316e8a886f49bd576c33",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/85/2d/328ea96e4729a7f378803c05c60e",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/c6/3e/384a51739fb898ce03e88fd165e9",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/5d/0f/ae0078422cbfa2030501db9bf0b5",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/97/91/9a9b875d865949c9d6e28b327b86",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/90/2c/1520b8c574430c4dd8168aa46a9f",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/c1/f0/e3ff659748399873acb4ede80ffd",
"build/prefab/full/linux_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1b/b8/532a6971b2fcde399db71380f199",
"build/prefab/full/linux_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/e1/c6/129b00c453204caf4b527a1e7bf5",
"build/prefab/full/linux_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ec/2c/9b26c894d69e4f78b29d3e7c14ca",
"build/prefab/full/linux_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/26/f9/d6f77a2ed0a847b3cc3cbab51223",
"build/prefab/full/linux_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/31/42/26c9e0ead4d1b17960834c0e9a17",
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/7b/25/e55d4e007315295d9fbbc19ff3f1",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/91/c3/78db3cff1c37f2028f4cf1dbb435",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/76/34/c5e097bfddd0379b92d9aa1ef42e",
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/11/c7/b8c4ce04f15b6ee2a8fe34ed9a8c",
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/0c/15/6da0ded38e64fed5778b15a9dc58",
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/1d/6d/e7e3ee414c73f2857531de2a362a",
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/1d/76/b762b765eaf6c85ca7346cda68ed",
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/1c/2b/da531e1c3f5a0778c97175a3ac84",
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/da/c7/c2829f0e2aaf47ff706d6cfadb6a",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ad/d0/51afd6f99890fb7a3dbb05ca9d14",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/b9/29/d7e921e6239e27ecc39d2dfe9910",
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/49/c8/cf436fc6e64192bfc5b23393eeab",
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/34/b0/8592d685b1a2c85308ede3494746",
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/41/d2/6923abda66b4b7f8c73e8a9ef78b",
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/04/30/75863a1df70641893045cd4bf8af",
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/58/55/b6ae6dd4f3615fa87bb170a43233",
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/b9/f8/37285d0ced7794a82534d13c33ac",
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/c7/cc/0c5f0afbfa0ddabaea8d5838562a",
@ -4108,14 +4108,14 @@
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/96/2e/1b0ba43fe24fe9cc223a434db647",
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/f3/83/581b7df96f6516032a0747b83e15",
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/6a/6d/7aaf7617929eeff41bc5a574e6c8",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/c3/00/abea5335d9f30806405451985391",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/bf/f6/a0f57ca4714cdada3469795efa70",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/97/ed/00e71906a026a8b16ed733250177",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/78/5c/9c421525f6a3ed8890d67c0067c0",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/74/33/b42b6e241fa782f6a82292da5fc7",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/4d/f3/0a55b91570b2d9eb40d75317ae3a",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/50/b4/3485d00c1b200dc753a9bef302c3",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/cb/27/82502b5ccea9a47d368e6f8c8c50",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/20/f0/4e9e3644c559e00816a8621a8987",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/7c/39/5390a4370b1c3a931a84abf6f477",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/f8/ec/e98d729c3d66249a1e11aa26af2d",
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/62/9c/2c38890b97307365059b162abe51",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/90/81/4d46be8eb3992b016a7c82f5766a",
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/18/09/af24159486d0253f900e262d9fd9",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/a8/f5/68bb806fdee3a4694352d1e03a60",
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/ee/96/8259473f7ed61dfdb8dd8af6f845",
"src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa",
"src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1",
"src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/75/9f/bcf597b362c9f2480cb348188bdd",

View File

@ -1,4 +1,4 @@
### 1.7.20 (build 21071, api 8, 2023-06-07)
### 1.7.20 (build 21072, api 8, 2023-06-08)
- This seems like a good time for a `refactoring` release in anticipation of
changes coming in 1.8. Basically this means that a lot of things will be

View File

@ -28,7 +28,7 @@ if TYPE_CHECKING:
# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 21071
TARGET_BALLISTICA_BUILD = 21072
TARGET_BALLISTICA_VERSION = '1.7.20'
_g_env_config: EnvConfig | None = None

View File

@ -134,9 +134,7 @@ void BaseFeatureSet::OnModuleExec(PyObject* module) {
void BaseFeatureSet::OnReachedEndOfBaBaseImport() {
assert(!base_import_completed_);
g_base->python->ImportPythonAppObjs();
base_import_completed_ = true;
}
@ -176,12 +174,12 @@ void BaseFeatureSet::StartApp() {
// Read the app config.
g_base->python->ReadConfig();
// Allow our subsystems to start doing work in their own threads
// and communicating with other subsystems. Note that we may still
// want to run some things serially here and ordering may be important
// (for instance we want to give our main thread a chance to register
// all initial input devices with the logic thread before the logic
// thread applies the current config to them).
// Allow our subsystems to start doing work in their own threads and
// communicating with other subsystems. Note that we may still want to run
// some things serially here and ordering may be important (for instance
// we want to give our main thread a chance to register all initial input
// devices with the logic thread before the logic thread applies the
// current config to them).
python->OnMainThreadStartApp();
logic->OnMainThreadStartApp();
@ -226,6 +224,7 @@ void BaseFeatureSet::set_app_mode(AppMode* mode) {
Log(LogLevel::kWarning,
"set_app_mode called with already-current app-mode; unexpected.");
}
try {
// Tear down previous mode (if any).
if (app_mode_) {
@ -275,9 +274,9 @@ void BaseFeatureSet::PrimeAppMainThreadEventPump() {
auto BaseFeatureSet::HavePlus() -> bool {
if (!plus_soft_ && !tried_importing_plus_) {
python->SoftImportPlus();
// Important to set this *after* import attempt, or a second import attempt
// while first is ongoing can insta-fail. Multiple import attempts shouldn't
// hurt anything.
// Important to set this *after* import attempt, or a second import
// attempt while first is ongoing can insta-fail. Multiple import
// attempts shouldn't hurt anything.
tried_importing_plus_ = true;
}
return plus_soft_ != nullptr;
@ -292,9 +291,9 @@ void BaseFeatureSet::set_plus(PlusSoftInterface* plus) {
auto BaseFeatureSet::plus() -> PlusSoftInterface* {
if (!plus_soft_ && !tried_importing_plus_) {
python->SoftImportPlus();
// Important to set this *after* import attempt, or a second import attempt
// while first is ongoing can insta-fail. Multiple import attempts shouldn't
// hurt anything.
// Important to set this *after* import attempt, or a second import
// attempt while first is ongoing can insta-fail. Multiple import
// attempts shouldn't hurt anything.
tried_importing_plus_ = true;
}
if (!plus_soft_) {
@ -306,9 +305,9 @@ auto BaseFeatureSet::plus() -> PlusSoftInterface* {
auto BaseFeatureSet::HaveClassic() -> bool {
if (!classic_soft_ && !tried_importing_classic_) {
python->SoftImportClassic();
// Important to set this *after* import attempt, or a second import attempt
// while first is ongoing can insta-fail. Multiple import attempts shouldn't
// hurt anything.
// Important to set this *after* import attempt, or a second import
// attempt while first is ongoing can insta-fail. Multiple import
// attempts shouldn't hurt anything.
tried_importing_classic_ = true;
}
return classic_soft_ != nullptr;
@ -318,9 +317,9 @@ auto BaseFeatureSet::HaveClassic() -> bool {
auto BaseFeatureSet::classic() -> ClassicSoftInterface* {
if (!classic_soft_ && !tried_importing_classic_) {
python->SoftImportClassic();
// Important to set this *after* import attempt, or a second import attempt
// while first is ongoing can insta-fail. Multiple import attempts shouldn't
// hurt anything.
// Important to set this *after* import attempt, or a second import
// attempt while first is ongoing can insta-fail. Multiple import
// attempts shouldn't hurt anything.
tried_importing_classic_ = true;
}
if (!classic_soft_) {
@ -337,9 +336,9 @@ void BaseFeatureSet::set_classic(ClassicSoftInterface* classic) {
auto BaseFeatureSet::HaveUIV1() -> bool {
if (!ui_v1_soft_ && !tried_importing_ui_v1_) {
python->SoftImportUIV1();
// Important to set this *after* import attempt, or a second import attempt
// while first is ongoing can insta-fail. Multiple import attempts shouldn't
// hurt anything.
// Important to set this *after* import attempt, or a second import
// attempt while first is ongoing can insta-fail. Multiple import
// attempts shouldn't hurt anything.
tried_importing_ui_v1_ = true;
}
return ui_v1_soft_ != nullptr;
@ -349,9 +348,9 @@ auto BaseFeatureSet::HaveUIV1() -> bool {
auto BaseFeatureSet::ui_v1() -> UIV1SoftInterface* {
if (!ui_v1_soft_ && !tried_importing_ui_v1_) {
python->SoftImportUIV1();
// Important to set this *after* import attempt, or a second import attempt
// while first is ongoing can insta-fail. Multiple import attempts shouldn't
// hurt anything.
// Important to set this *after* import attempt, or a second import
// attempt while first is ongoing can insta-fail. Multiple import
// attempts shouldn't hurt anything.
tried_importing_ui_v1_ = true;
}
if (!ui_v1_soft_) {
@ -380,8 +379,8 @@ auto BaseFeatureSet::GetAppInstanceUUID() -> const std::string& {
}
}
if (!have_app_instance_uuid) {
// As an emergency fallback simply use a single random number.
// We should probably simply disallow this before Python is up.
// As an emergency fallback simply use a single random number. We
// should probably simply disallow this before Python is up.
Log(LogLevel::kWarning, "GetSessionUUID() using rand fallback.");
srand(static_cast<unsigned int>(
core::CorePlatform::GetCurrentMillisecs())); // NOLINT

View File

@ -47,7 +47,11 @@ static PyMethodDef PyAppNameDef = {
static auto PyRunApp(PyObject* self) -> PyObject* {
BA_PYTHON_TRY;
printf("WOULD RUN!\n");
FatalError("NOT WORKING YET; COME BACK SOON.");
assert(g_base);
g_base->RunAppToCompletion();
Py_RETURN_NONE;
BA_PYTHON_CATCH;
}

View File

@ -146,6 +146,14 @@ void CoreFeatureSet::PostInit() {
// Grab whatever Python stuff we use.
python->ImportPythonObjs();
// Normally we wait until babase is imported to push early logs through to
// Python (so that our log handling system is fully bootstrapped), but
// technically we can push our log calls out to Python any time now since
// we grabbed the logging calls above. Do so immediately here if asked.
if (!g_core->core_config().hold_early_logs) {
python->EnablePythonLoggingCalls();
}
// FIXME: MOVE THIS TO A RUN_APP_TO_COMPLETION() SORT OF PLACE.
// For now it does the right thing here since all we have is monolithic
// builds but this will need to account for more situations later.

View File

@ -127,8 +127,7 @@ void CorePython::EnablePythonLoggingCalls() {
assert(objs().Exists(ObjID::kLoggingErrorCall));
assert(objs().Exists(ObjID::kLoggingCriticalCall));
// Now that we've grabbed Python logging calls above, we can push any
// early log calls along to Python. They're no longer our problem.
// Push any early log calls we've been holding on to along to Python.
{
std::scoped_lock lock(early_log_lock_);
python_logging_calls_enabled_ = true;
@ -140,21 +139,12 @@ void CorePython::EnablePythonLoggingCalls() {
}
void CorePython::ImportPythonObjs() {
// Define a few calls we can use for environment setup.
// Grab core stuff that we might need before our _babase module gets spun up
// (which is when all the stuff in binding_base gets fetched).
// Note: Binding .inc files expect 'ObjID' and 'objs_' to be defined.
// Grab core Python objs we use.
#include "ballistica/core/mgen/pyembed/binding_core.inc"
// Normally we wait until babase is imported to push early logs through to
// Python (so that our log handling is fully bootstrapped), but technically
// we can push things out to Python any time now since we grabbed the logging
// calls above. Do so if asked.
if (!g_core->core_config().hold_early_logs) {
EnablePythonLoggingCalls();
}
// Also grab a few things we define in env.inc. Normally this sort of
// thing would go in _hooks.py in our Python package, but because we are
// core we don't have one, so we have to do it via inline code.
{
#include "ballistica/core/mgen/pyembed/env.inc"
auto ctx = PythonRef(PyDict_New(), PythonRef::kSteal);

View File

@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica {
// These are set automatically via script; don't modify them here.
const int kEngineBuildNumber = 21071;
const int kEngineBuildNumber = 21072;
const char* kEngineVersion = "1.7.20";
auto MonolithicMain(const core::CoreConfig& core_config) -> int {

View File

@ -37,7 +37,7 @@ void FatalError::ReportFatalError(const std::string& message,
// immediately in order to get the debugger's attention.
if (g_core && g_core->core_config().debugger_attached) {
if (!message.empty()) {
printf("FATAL ERROR: %s\n", message.c_str());
printf("FATAL ERROR (debugger mode): %s\n", message.c_str());
fflush(stdout);
}
abort();
@ -78,6 +78,8 @@ void FatalError::ReportFatalError(const std::string& message,
+ "\nCPP-STACK-TRACE-END");
}
delete trace;
} else {
logmsg += "\n(CPP-STACK-TRACE-UNAVAILABLE)";
}
}
}