By default, gRPC fetches TXT report while resolving a domain.
0914bba6c5/internal/resolver/dns/dns_resolver.go (L336)
This leads to a hanging dial if DNS is unavailable, even though the host
may be specified in `/etc/hosts` (hello, localhost!).
Use `grpc.WithDisableServiceConfig()` to override the default.
This option seems impossible to override with `WithGRPCDialOpts()`,
but we do not use service config anyway.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
There is a race condition: multiple clients are created and dialled,
but only one is stored in the map. Others are remaining active but not
used.
With this change, new connection replaces old connection and closes
it.
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
According to https://pkg.go.dev/context#pkg-variables, ContextCancelled
should be returned when the context is canceled for some reason other
than its deadline passing. So creating gRPC stream with dial timeout fits
better for context.DeadlineExceeded.
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
To avoid connection leak, call `close()` immediately after connection
is established. In regular tree pool, unhealthy connections are handled
by background goroutine which calls `redialIfNecessary()` to reestablish
connection. Here it is not viable so connection must be close.
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
Two concurrent 'deleteClientFromMap' calls for
the same client may produce panic and deadlock.
First goroutine acquires lock, removes element
from the map, releases lock.
Second goroutine acquires lock, and throws panic
while trying to call 'close()' on empty struct.
Lock is never released and it causes deadlock for
other goroutines.
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
New version of tree/pool selects tree service connection to make request based on the current net map and container placement policy
Signed-off-by: Marina Biryukova <m.biryukova@yadro.com>
Since api was moved from `TrueCloudLab/frostfs-api-go` to sdk,
moving changes from TrueCloudLab/frostfs-api-go#125 here.
Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
* `c.conn` may be already invalidated but the rpc client can't detect this.
`NewStream` may hang trying to open a stream with invalidated connection.
Using timer with `dialTimeout` for `NewStream` fixes this problem.
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
* Sending empty chunks by `writeChunk` should not release new
objects as this doesn't change `payloadSizeLimiter` internal
state.
* This also fixes the bug with patcher when an offset of a patch
equals to `MaxSize` - `payloadSizeLimiter` releases object again
although state is the same. This led to error because EC-encoder
receieved empty payload and couldn't not process it.
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
Implemented context timeout for all tree service operations except those that return a GRPC stream
Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>