Verify cache behavior #30
Labels
No Label
ussd/user-reported
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: grassrootseconomics/sarafu-vise#30
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Identify one menu location where unnecessary reload is used, and verify that the cache will provide the value without calling external function.
Once verified, gradually use this method to optimize similar menu locations.
See these logs from a recent error that affected all users. The error was popping up immediately one accessed the USSD.
The error returned from the USSD was
unknown symbol: manage_vouchers
or any other symbol that was skipped.Restarting the USSD resolved it, but the root cause is yet to be identified
Logs for a similar issue encountered:
Additional logs
Noted differences between valid requests and invalid ones during a crash.
Valid request
Invalid request
The cache loaded when there's a downtime for the sessionId
+254724942097
isca=&{0 4294963143 [map[check_balance:Salio: 5866.56 MEDENE....
The cache loaded after a restart and subsequent valid requests for the same sessionId
+254724942097
isca=&{0 0 [map[]] map[authorize_account:6 check_account_created:2 check_blocked_status:1....
Things to note
(Salio: 5866.56 MEDENE)
is in Swahili (correct language should be English)MEDENE
voucherThis concludes that the logged data belongs to a different sessionId and not
+254724942097
The cache might therefore be improperly stored after some time, or improperly retrieved, leading to the previous symbols being stuck in the cache and skipped when the menu runs a
RELOAD
Attached are the logs comparing the valid and invalid USSD request
Additional logs for a crash that happens after a restart
These logs capture all requests that lead up to an error response for all incoming requests
ussd-1 | [D] atserver:parse.go:48 Received request: {"body":"phoneNumber=%2B254711777734\u0026serviceCode=%2A384%2A96%23\u0026text=\u0026sessionId=ATUid_c1a625991c5c02f7a6da9522a1f61e66\u0026networkCode=63902"}=??
ussd-1 | [I] visedriver.request:base.go:68 new request data={context.Background.WithValue(net/http context value http-server, *http.Server).WithValue(net/http context value local-addr, 172.18.0.10:7123).WithCancel.WithCancel sessionid '+254711777734', rootpath 'root', flagcount 128, language '' [] 0xc0003ce2a0 false}
ussd-1 | [D] engine:db.go:214 ca ca=&{0 0 [map[]] map[authorize_account:6 check_account_created:2 check_account_status:0 check_blocked_status:1 check_identifier:0 check_pin_mismatch:6 check_transactions:0 clear_temporary_value:2 confirm_new_alias:0 confirm_pin_change:0 create_account:0 fetch_community_balance:0 get_amount:32 get_current_profile_info:0 get_profile_info:0 get_recipient:0 get_sender:64 get_suggested_alias:0 get_transactions:0 get_voucher_details:0 get_vouchers:0 initiate_transaction:0 invite_valid_recipient:0 max_amount:40 quit:0 quit_with_help:0 request_custom_alias:0 reset_account_authorized:16 reset_allow_update:0 reset_api_call_failure:6 reset_incorrect:6 reset_incorrect_date_format:8 reset_invalid_pin:6 reset_others_pin:6 reset_transaction_amount:0 reset_unregistered_number:0 retrieve_blocked_number:0 save_familyname:64 save_firstname:128 save_gender:32 save_location:16 save_offerings:8 save_others_temporary_pin:6 save_temporary_pin:6 save_yob:32 set_back:6 set_default_voucher:8 set_language:6 set_voucher:12 show_blocked_account:0 transaction_reset:0 update_all_profile_items:0 validate_amount:64 validate_blocked_number:6 validate_recipient:50 verify_create_pin:8 verify_new_pin:2 verify_yob:6 view_statement:0 view_voucher:80] false}
ussd-1 | [I] persist:persist.go:126 loaded state and cache self=persister @0xc00052b380 state:0xc00017f900 cache:0xc00052b3c0, key=+254711777734, state=state @0xc00017f900 moves: 2081 idx: 0 flags: 0x045020809f000000000000000000000000 path: lang: swa (Swahili (macrolanguage))
ussd-1 | [I] vm:runner.go:63 vm created with state state=state @0xc00017f900 moves: 2081 idx: 0 flags: 0x045020809f000000000000000000000000 path: lang: swa (Swahili (macrolanguage)), renderer=
ussd-1 | [D] engine:db.go:329 start pre-VM check
ussd-1 | [I] vm:runner.go:63 vm created with state state=state @0xc00017f900 moves: 2082 idx: 0 flags: 0x045020809f000000000000000000000000 path: _first lang: swa (Swahili (macrolanguage)), renderer=
ussd-1 | [D] vm:runner.go:152 execute code opcode=3, op=LOAD, code=065f666972737401000007
ussd-1 | [D] vm:runner.go:153 state=state @0xc00017f900 moves: 2082 idx: 0 flags: 0x105020809f000000000000000000000000 path: _first lang: swa (Swahili (macrolanguage))
ussd-1 | [D] ussdmenuhandler:menuhandler.go:153 handler has been initialized state=state @0xc00017f900 moves: 2082 idx: 0 flags: 0x105020809f000000000000000000000000 path: _first lang: swa (Swahili (macrolanguage)), cache=&{0 22 [map[check_balance:Balance: 152.31 5STAR
ussd-1 | check_vouchers: manage_vouchers:] map[]] map[authorize_account:6 check_account_created:2 check_account_status:0 check_balance:128 check_blocked_status:1 check_identifier:0 check_pin_mismatch:6 check_transactions:0 check_vouchers:10 clear_temporary_value:2 confirm_new_alias:0 confirm_pin_change:0 create_account:0 fetch_community_balance:0 get_amount:32 get_current_profile_info:0 get_profile_info:0 get_recipient:0 get_sender:64 get_suggested_alias:0 get_transactions:0 get_voucher_details:0 get_vouchers:0 initiate_transaction:0 invite_valid_recipient:0 manage_vouchers:160 max_amount:40 quit:0 quit_with_help:0 request_custom_alias:0 reset_account_authorized:16 reset_allow_update:0 reset_api_call_failure:6 reset_incorrect:6 reset_incorrect_date_format:8 reset_invalid_pin:6 reset_others_pin:6 reset_transaction_amount:0 reset_unregistered_number:0 retrieve_blocked_number:0 save_familyname:64 save_firstname:128 save_gender:32 save_location:16 save_offerings:8 save_others_temporary_pin:6 save_temporary_pin:6 save_yob:32 set_back:6 set_default_voucher:8 set_language:6 set_voucher:12 show_blocked_account:0 transaction_reset:0 update_all_profile_items:0 validate_amount:64 validate_blocked_number:6 validate_recipient:50 verify_create_pin:8 verify_new_pin:2 verify_yob:6 view_statement:0 view_voucher:80] false}, x-SessionId=+254711777734
ussd-1 | [D] cache:cache.go:70 Cache add key=_first, size=0, limit=0
ussd-1 | [D] vm:runner.go:152 execute code opcode=7, op=HALT, code=
ussd-1 | [D] vm:runner.go:153 state=state @0xc00017f900 moves: 2082 idx: 0 flags: 0x105020809f000000000000000000000000 path: _first lang: swa (Swahili (macrolanguage))
ussd-1 | [D] vm:runner.go:440 found HALT, stopping
ussd-1 | [D] engine:db.go:361 end pre-VM check
ussd-1 | [D] cache:cache.go:171 Cache free frame=1, key=_first, size=0
ussd-1 | [I] engine:db.go:521 new VM execution with input input=
ussd-1 | [D] engine:db.go:530 start VM run code=0008077365745f656e6701310008077365745f73776101320008012e012a
ussd-1 | [D] vm:runner.go:152 execute code opcode=8, op=INCMP, code=077365745f656e6701310008077365745f73776101320008012e012a
ussd-1 | [D] vm:runner.go:153 state=state @0xc00017f900 moves: 2083 idx: 0 flags: 0x105020809f000000000000000000000000 path: lang: swa (Swahili (macrolanguage))
ussd-1 | [D] vm:runner.go:152 execute code opcode=8, op=INCMP, code=077365745f73776101320008012e012a
ussd-1 | [D] vm:runner.go:153 state=state @0xc00017f900 moves: 2083 idx: 0 flags: 0x115020809f000000000000000000000000 path: lang: swa (Swahili (macrolanguage))
ussd-1 | [D] vm:runner.go:152 execute code opcode=8, op=INCMP, code=012e012a
ussd-1 | [D] vm:runner.go:153 state=state @0xc00017f900 moves: 2083 idx: 0 flags: 0x115020809f000000000000000000000000 path: lang: swa (Swahili (macrolanguage))
ussd-1 | [D] vm:runner.go:399 input wildcard match input=, next=.
ussd-1 | [E] engine:db.go:533 fail VM run with state code=, state=state @0xc00017f900 moves: 2084 idx: 0 flags: 0x125020809f000000000000000000000000 path: lang: swa (Swahili (macrolanguage)), vm=vm (0xc0007538c0) ok
Resolved in https://git.grassecon.net/grassrootseconomics/sarafu-vise/releases/tag/v1.2.5-rc.2
Commit:
3b44b4b9e7