-
Notifications
You must be signed in to change notification settings - Fork 1
#mmn164: Update stress test to remove irrelevant transaction errors from report #491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
#mmn164: Update stress test to remove irrelevant transaction errors from report #491
Conversation
| if err != nil { | ||
| // If transaction failed due to context cancellation, do not count it as failed | ||
| if contains(err.Error(), "context canceled") || lt.ctx.Err() == context.Canceled { | ||
| atomic.AddInt64(<.totalTxsSent, -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
đoạn này có nên check totalTxsent <0 trước khi giảm không ô nhỉ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Đoạn này tôi nghĩ là không cần check, vì là trước khi gọi vào hàm sendTransaction() ta đã tăng totalTxsSent lên trước đó rồi => nên không cần thiết phải check totalTxsSent < 0
| if !lt.incrementAndCheckLimit() { | ||
| return | ||
| } | ||
|
|
||
| lt.wg.Add(1) | ||
| go func() { | ||
| defer lt.wg.Done() | ||
| lt.sendTransaction(sender, receiver, nonce, txErr) | ||
| }() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theo như tôi hiểu thì đoạn này đang tăng tx trước khi send , oke cái này để confirm thôi nếu đúng thì....vấn đề thực sự trong hàm send này ô ạ, có vẻ như nếu send lỗi hay như nào đó ( return sớm ) mà không có logic rollback lại cái total tx vừa tăng lên . Nếu đúng là như vậy thì tôi nghĩ trong này nên có một hàm helper kiểu rollbackcounttx để ở bất cứ nơi nào return sớm trong hàm sendTx này!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cũng đúng, với code hiện tại hàm sendTransaction() đang có 1 logic lắng nghe sự kiện nếu context bị hủy ngang khi đang xử lý tạo transaction mà chưa gọi đến hàm AddTx() => thì sẽ không có logic để rollback lại totalTxsSent

Hướng giải quyết:
- Hiện tại trong hàm
sendTransaction()chỉ có logic nói ở trên là không cập nhật gì về số lượng transaction => còn các logic khác đều đã có logic để xử lý số lượng transaction để đảm bảototalTxsSent = totalTxsSuccess + totalTxsFailedtrước khi return.
=> Tôi sẽ xóa logic lắng nghe sự kiệncontext cancelở hàmsendTransaction()đi =>nếu đang send mà bịcontext cancelthì hàmAddTx()sẽ trả về false => sẽ ăn vào ngay logic rollback ở đó - Hình ảnh test lại với code mới (TPS: 3000, đang chạy thì ctrl + C giữa chừng (dừng đột ngột)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeahhh
Cũng đúng, với code hiện tại hàm
sendTransaction()đang có 1 logic lắng nghe sự kiện nếu context bị hủy ngang khi đang xử lý tạo transaction mà chưa gọi đến hàmAddTx()=> thì sẽ không có logic để rollback lạitotalTxsSentHướng giải quyết:
- Hiện tại trong hàm
sendTransaction()chỉ có logic nói ở trên là không cập nhật gì về số lượng transaction => còn các logic khác đều đã có logic để xử lý số lượng transaction để đảm bảototalTxsSent = totalTxsSuccess + totalTxsFailedtrước khi return.
=> Tôi sẽ xóa logic lắng nghe sự kiệncontext cancelở hàmsendTransaction()đi =>nếu đang send mà bịcontext cancelthì hàmAddTx()sẽ trả về false => sẽ ăn vào ngay logic rollback ở đó- Hình ảnh test lại với code mới (TPS: 3000, đang chạy thì ctrl + C giữa chừng (dừng đột ngột)
![]()
yeah


No description provided.