Open erkexzcx opened 1 year ago
I've found the exception:
java.lang.RuntimeException: okhttp3.internal.http2.StreamResetException: stream was reset: NO_ERROR
Quick Google revealed that it could be fixed by adding these (maybe because I am using HTTP3 caused this error?):
// Import this one too
import okhttp3.Protocol;
// When setting up client, add protocols line, so it looks like this
client = new OkHttpClient.Builder()
.connectTimeout(CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS)
.readTimeout(SOCKET_TIMEOUT, TimeUnit.MILLISECONDS)
.writeTimeout(SOCKET_TIMEOUT, TimeUnit.MILLISECONDS)
.protocols(Collections.singletonList(Protocol.HTTP_1_1))
.addNetworkInterceptor(new Interceptor() {
...
...
...
Then goes another issue:
Not sure what above errors mean, but it looks like there were zero points as well:
Could it be that the method upload
is called when data is submitted manually, but data is not being given to that method? As you can see in the picture - method was called and there were only zeroes passed. In the Android emulator I've added glucose measurement manually.
I've tried to hardcode some dummy point, so points list wouldn't be empty - same issue.
Looks like there is an update for influxdb-java
dependency: https://mvnrepository.com/artifact/org.influxdb/influxdb-java
Also tried old version without okhttp3
(http client) - same thing happens, so I assume it's influxdb-java
that is failing. I don't know. Or maybe because I have HTTP3 for TSDB connections. 🤷
Please don't open an issue unless you are asked to do so by a developer.
Its okay we can discuss this issue here. Its possible that the influxdb client is outdated. @erkexzcx can you describe what you are connecting to.
The code you pasted above looks like it would lock to http protocol 1.1 - I'm not sure I understand the significance of that. From your investigations have you been able to replicate and then resolve the problems or are you still trying to find a resolution?
Hi.
@erkexzcx can you describe what you are connecting to.
There is a not-so-well known TSDB called VictoriaMetrics. It is basically a "Prometheus on steroids" kind of TSDB that can also accept InfluxDB metrics through it's HTTP endpoint. I've been using this setup for almost a year without any issues, including querying metrics via Grafana (using PromQL) as well as pushing metrics (as InfluxDB endpoint) from my personal servers. The same setup I have in corporate environment where VictoriaMetrics ingests metrics via InfluxDB (influx line protocol) and works perfectly.
I've tried to push data from xDrip+ application (via Cloud Upload
-> InfluxDB
) to the same VictoriaMetrics HTTP endpoint that I am using with my other projects/servers and they all work just fine, except xDrip+. Whatever I do, I just end up with java.lang.RuntimeException
exception and I can't figure out why it is throwing this error. To me it looks like that influxdb-java
is throwing this error as it attempts to write data to TSDB, but behind the scenes it is using okhttp3
HTTP client (the reason why this HTTP client is used because this is the only way to implement HTTP timeout (by passing a modified HTTP client to influxdb-java
)).
I have suspicion that it is failing because I am using HTTPS, more specifically HTTP3 (with TLS). As far as I know, if client does not support HTTP3, it will default back to HTTP2. Note that TLS (as well as HTTP3 and basic auth) is added by a reverse proxy (Caddy), but IMO it does not matter if it's Caddy, Nginx, Traefik or any other reverse proxy.
If you provide me your email, later today I can provide you a playground instance (TSDB and Grafana) for you, so you don't have to setup your own test environment.
I believe you should try the following:
okhttp3
and influxdb-java
gradle dependencies to check if it fixes the issue.okhttp3
HTTP client (also did not work to me).Note that I have zero Android development experience and a bit of Java. I especially struggled with Gradle stuff as my attempts to upgrade those dependencies ended up breaking a whole build of the project. ☹️
The code you pasted above looks like it would lock to http protocol 1.1 - I'm not sure I understand the significance of that.
It's just what quick Google suggested me to do. 🤷♂️ You can ignore this part I would say...
From your investigations have you been able to replicate and then resolve the problems or are you still trying to find a resolution?
I am still trying to find a solution. See my previous message, I believe you should try the following
part.
@jamorham - I've sent you an email to your Gmail with playground TSDB instance url/credentials. Also included curl examples for you to try.
Hopefully updating dependencies okhttp3
and influxdb-java
might be enough...
I am trying to setup Cloud Upload --> InfluxDB functionality, which seems to be broken. I constantly get the following error (I confirm that I've entered correct details):
The same TSDB configuration works with other utilities without any issues. For example, connecting to the same InfluxDB from Telegraf, I use below configuration fragment:
Caddy (reverse proxy that adds TLS as well as basic HTTP auth) - works fine with Telegraf too. Maybe because it has HTTP3 enabled and
okhttp3
dependency does not support it?I literally have zero clue of what might cause this behavior, but it is clear to me - there is a bug somewhere in the app. It should work fine, but it does not.
Please contact me via erikmnkl@gmail.com (prior let me know your email here from which you will be contacting) so I can setup a playground instance for you using the same configuration.
I guess I should tag @pimeys as you've been mentioned as an author of this integration. :)
EDIT: Looks like this is part that is failing: https://github.com/NightscoutFoundation/xDrip/blob/master/app/src/main/java/com/eveningoutpost/dexdrip/InfluxDB/InfluxDBUploader.java#L116