Open BetaXOi opened 4 years ago
OK, i will try to add a new test case for timeout
I have rebased and add a test for timeout. But the test case has some problems:
DIV_ROUND_UP (tv.tv_usec, (1000000 / HZ))
see https://github.com/torvalds/linux/blob/master/net/vmw_vsock/af_vsock.c#L1571[root@localhost vsock]# for i in
seq 10
; do go test -v -race -run TestIntegrationConnTimeout; done === RUN TestIntegrationConnTimeout --- PASS: TestIntegrationConnTimeout (0.01s) PASS ok github.com/mdlayher/vsock 0.052s === RUN TestIntegrationConnTimeout TestIntegrationConnTimeout: integration_linux_test.go:235: connect with a very short dial timeout expectETIMEDOUT
, but got--- FAIL: TestIntegrationConnTimeout (0.00s) FAIL exit status 1 FAIL github.com/mdlayher/vsock 0.032s === RUN TestIntegrationConnTimeout --- PASS: TestIntegrationConnTimeout (0.00s) PASS ok github.com/mdlayher/vsock 0.049s === RUN TestIntegrationConnTimeout --- PASS: TestIntegrationConnTimeout (0.00s) PASS ok github.com/mdlayher/vsock 0.042s === RUN TestIntegrationConnTimeout --- PASS: TestIntegrationConnTimeout (0.00s) PASS ok github.com/mdlayher/vsock 0.048s === RUN TestIntegrationConnTimeout --- PASS: TestIntegrationConnTimeout (0.00s) PASS ok github.com/mdlayher/vsock 0.046s === RUN TestIntegrationConnTimeout --- PASS: TestIntegrationConnTimeout (0.00s) PASS ok github.com/mdlayher/vsock 0.046s === RUN TestIntegrationConnTimeout TestIntegrationConnTimeout: integration_linux_test.go:235: connect with a very short dial timeout expect ETIMEDOUT
, but got--- FAIL: TestIntegrationConnTimeout (0.00s) FAIL exit status 1 FAIL github.com/mdlayher/vsock 0.033s === RUN TestIntegrationConnTimeout TestIntegrationConnTimeout: integration_linux_test.go:235: connect with a very short dial timeout expect ETIMEDOUT
, but got--- FAIL: TestIntegrationConnTimeout (0.00s) FAIL exit status 1 FAIL github.com/mdlayher/vsock 0.031s === RUN TestIntegrationConnTimeout --- PASS: TestIntegrationConnTimeout (0.00s) PASS ok github.com/mdlayher/vsock 0.050s [root@localhost vsock]#
Thank you for the PR and I apologize for the delay: I am mostly on hiatus from open source software development at the moment. However I intend to address this and the other outstanding PRs as part of #45 and will follow up once I'm able to do so. Thanks again.
Hi there, I apologize for the delay. With the advent of v1.0.0, perhaps it might make sense to add timeout as a parameter to the vsock.Config
struct. I made the decision to share the config fields between Dial and Listen so I'd want to see if a timeout might make sense on that side too.
I'll do some investigation into what socket options are available too.
I wonder if DialContext would be more flexible. It would also match the net and gRPC packages:
We need to use
Dial
with timeout feature in Kata, see https://github.com/kata-containers/runtime/issues/1917#issuecomment-625069513Signed-off-by: Ning Bo ning.bo9@zte.com.cn