Skip to content
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

Client.Close() blocked by write API Flush() (if (?) it can't send metrics) #318

Closed
i-prudnikov opened this issue Mar 22, 2022 · 2 comments · Fixed by #324
Closed

Client.Close() blocked by write API Flush() (if (?) it can't send metrics) #318

i-prudnikov opened this issue Mar 22, 2022 · 2 comments · Fixed by #324

Comments

@i-prudnikov
Copy link

Steps to reproduce:

  1. Instantiate client and use non blocking write API
  2. Experience error while sending data (in my case I got the following error):
influxdb2client E! Write error: unprocessable entity: failure writing points to database: partial write: field type conflict: input field "value" on measurement "xxxxxx" is type unsigned, already exists as type integer dropped=28
  1. De init client by calling client.Close()

Expected behaviour:
client.Close() will not block by unsuccessful flushing.

Actual behavior:
client.Close() blocked by calling write API Flush():
Stack trace of blocked goroutine:

runtime.gopark(proc.go:367)
runtime.chansend(chan.go:257)
runtime.chansend1(chan.go:143)
github.com/influxdata/influxdb-client-go/v2/api.(*WriteAPIImpl).waitForFlushing(write.go:125)
github.com/influxdata/influxdb-client-go/v2/api.(*WriteAPIImpl).Flush(write.go:111)
github.com/influxdata/influxdb-client-go/v2/api.(*WriteAPIImpl).Close(write.go:199)
github.com/influxdata/influxdb-client-go/v2.(*clientImpl).Close(client.go:242)

Specifications:

  • Client Version: 2.8.0
  • InfluxDB Version: 2.1.1
  • Platform: Client - Darwin, Server - Linux
@i-prudnikov i-prudnikov changed the title Client.Close() cause blocking during write API Flush() if (?) it can't send metrics Client.Close() blocked by write API Flush() (if (?) it can't send metrics) Mar 22, 2022
@vlastahajek
Copy link
Contributor

vlastahajek commented Apr 14, 2022

@i-prudnikov, I cannot reproduce this. There is no logic for waiting for unsuccessful writes. Flushing could be blocked if you have another routine which is still writing when you are closing the client.
Could you, please, enable debug logging, reproduce the issue, and past the log here?

@i-prudnikov
Copy link
Author

i-prudnikov commented Apr 15, 2022

Hi @vlastahajek,
I did double check and found out that the reason of blocking is channel returned by writeAPI.Errors()
So if writeAPI is asked for a channel even like this _ = writeAPI.Errors() then it leads to a deadlock if error occurred but the error channel is not pooled. So looks like a feature not a bug. Though I would vote for a non-blocking write into an error channel, otherwise seemed confusing.
Feel free to close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants