File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed
Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,30 @@ namespace AElf.Runtime.CSharp;
2121
2222public class Executive : IExecutive
2323{
24+ /// <summary>
25+ /// Safely converts an exception to string, handling cases where ToString() might fail
26+ /// (e.g., during StackOverflowException when getting StackTrace causes another overflow)
27+ /// </summary>
28+ private static string SafeExceptionToString ( Exception ex )
29+ {
30+ try
31+ {
32+ return ex . ToString ( ) ;
33+ }
34+ catch
35+ {
36+ // Fallback to simple message if ToString() fails (e.g., during stack overflow)
37+ try
38+ {
39+ return $ "{ ex . GetType ( ) . Name } : { ex . Message } ";
40+ }
41+ catch
42+ {
43+ return "Exception occurred (unable to retrieve details)" ;
44+ }
45+ }
46+ }
47+
2448 private readonly ReadOnlyDictionary < string , IServerCallHandler > _callHandlers ;
2549 private readonly object _contractInstance ;
2650 private readonly ServerServiceDefinition _serverServiceDefinition ;
@@ -148,7 +172,7 @@ public void Execute()
148172 catch ( Exception ex )
149173 {
150174 CurrentTransactionContext . Trace . ExecutionStatus = ExecutionStatus . SystemError ;
151- CurrentTransactionContext . Trace . Error += ex + "\n " ;
175+ CurrentTransactionContext . Trace . Error += SafeExceptionToString ( ex ) + "\n " ;
152176 }
153177 finally
154178 {
@@ -185,7 +209,7 @@ private void ExecuteTransaction(IServerCallHandler handler)
185209 catch ( Exception ex )
186210 {
187211 CurrentTransactionContext . Trace . ExecutionStatus = ExecutionStatus . ContractError ;
188- CurrentTransactionContext . Trace . Error += ex + "\n " ;
212+ CurrentTransactionContext . Trace . Error += SafeExceptionToString ( ex ) + "\n " ;
189213 }
190214 }
191215
Original file line number Diff line number Diff line change @@ -23,17 +23,28 @@ jobs:
2323 df -h /
2424 # Remove unnecessary pre-installed software to free disk space
2525 sudo rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/6.* || true
26+ df -h /
2627 sudo rm -rf /usr/share/dotnet/shared/Microsoft.AspNetCore.App/7.* || true
28+ df -h /
2729 sudo rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/6.* || true
30+ df -h /
2831 sudo rm -rf /usr/share/dotnet/shared/Microsoft.NETCore.App/7.* || true
32+ df -h /
2933 sudo rm -rf /usr/local/lib/android || true
34+ df -h /
3035 sudo rm -rf /opt/ghc || true
36+ df -h /
3137 sudo rm -rf /usr/share/swift || true
38+ df -h /
3239 sudo rm -rf /usr/local/share/powershell || true
40+ df -h /
3341 sudo rm -rf /usr/local/share/chromium || true
42+ df -h /
3443 sudo rm -rf /usr/local/.ghcup || true
44+ df -h /
3545 # Clean apt cache
3646 sudo apt-get clean || true
47+ df -h /
3748 # Clean Docker images
3849 docker system prune -af || true
3950 echo "=== Disk space after cleanup ==="
You can’t perform that action at this time.
0 commit comments