RunTimeoutExperiment.bat 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. @echo off
  2. REM ============================================================
  3. REM UppPay timeout threshold experiment
  4. REM Reproduces HttpServices.cs Post() against a deliberately slow
  5. REM server so the real client-side timeout can be measured.
  6. REM
  7. REM Scenario A server stalls 200s, client sets NO Timeout
  8. REM -> expect failure at ~100 s (.NET default)
  9. REM Scenario B server stalls 200s, client sets Timeout=30 s
  10. REM -> expect failure at ~30 s
  11. REM Scenario C server answers 504 after 3 s
  12. REM -> expect ProtocolError, NOT Timeout
  13. REM
  14. REM Scenario C proves a proxy 504 can never produce the message
  15. REM "The operation has timed out" that appears in the real log.
  16. REM ============================================================
  17. setlocal
  18. set TOOLS=%~dp0
  19. echo ============================================================
  20. echo UppPay timeout threshold experiment
  21. echo workdir: %TOOLS%
  22. echo ============================================================
  23. echo.
  24. REM ---------- Scenario A : no Timeout (current production behaviour)
  25. echo [A] server stalls 200 s, client Timeout NOT set ...
  26. start "slow8099" /min "%PYEXE%" "%TOOLS%slow_server.py" 200 8099
  27. timeout /t 2 /nobreak >nul
  28. powershell -NoProfile -ExecutionPolicy Bypass -File "%TOOLS%timeout_probe.ps1" -Url "http://127.0.0.1:8099/"
  29. echo.
  30. REM ---------- Scenario B : Timeout = 30 s
  31. echo [B] server stalls 200 s, client Timeout = 30 s ...
  32. start "slow8098" /min "%PYEXE%" "%TOOLS%slow_server.py" 200 8098
  33. timeout /t 2 /nobreak >nul
  34. powershell -NoProfile -ExecutionPolicy Bypass -File "%TOOLS%timeout_probe.ps1" -Url "http://127.0.0.1:8098/" -TimeoutMs 30000
  35. echo.
  36. REM ---------- Scenario C : proxy answers 504
  37. echo [C] proxy answers 504 after 3 s ...
  38. start "gw8097" /min "%PYEXE%" "%TOOLS%gw_504_server.py" 3 8097
  39. timeout /t 2 /nobreak >nul
  40. powershell -NoProfile -ExecutionPolicy Bypass -File "%TOOLS%timeout_probe.ps1" -Url "http://127.0.0.1:8097/" -TimeoutMs 60000
  41. echo.
  42. echo ============================================================
  43. echo RESULT SUMMARY
  44. echo ------------------------------------------------------------
  45. echo A no Timeout -> fails at ~100 s (Status=Timeout)
  46. echo B Timeout=30 s -> fails at ~30 s (Status=Timeout)
  47. echo C proxy 504 -> fails at ~3 s (Status=ProtocolError)
  48. echo
  49. echo The real log message is "The operation has timed out",
  50. echo which matches A and B, never C. So UppPay is NOT sitting
  51. echo behind a 504 proxy, and the threshold is 100 s today,
  52. echo NOT 30 s.
  53. echo ============================================================
  54. endlocal