-
Notifications
You must be signed in to change notification settings - Fork 28
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
Getting com.google.gson.stream.MalformedJsonException on all API calls #120
Comments
never mind, it was a completely unrelated config issue. No clue why it manifested itself in such a cryptic way |
The issue is back, in fact it's not a config issue in the end. It appears to be intermittent - which means it is also unrelated to the server itself. If I let the server run long enough, at some point the problem occurs, and then there is no turning back, once this error happens, ALL subsequent API calls fail. The only option is to restart the server. So any idea/help would indeed be much appreciated. |
Hello @thonier and sorry for this late answer. I guess this issue is always not recurring one on your side? Thanks for your feedback, we will keep you posted here with any useful updates. Mickaël |
Hello @thonier, Is this issue still present, if so can you please provide some extra information? Thank you, |
Hi guys, Just as I was saying we had not seen the issue in a while, it is back... so right now our server is in a state where any call to mangopay via the sdk fails with the error above. Here is a sample log: I wonder if the trigger is not trying to create a new User via the sdk. I will try to explore this clue. Thanks. |
So it does seem to happen consistently on our test server when doing a mango User creation - with the stack trace above. However if I attempt to debug it locally, all goes well, so no idea what is going on. Not sure how to get you more info on that. Any suggestion? |
Not sure if that helps, but I have compiled from source and added some debug log. It turns out the faulty message you are trying to parse (and which comes back from Mango presumably) is:
That makes no sense to me, but maybe it does to you? Thanks |
So I figured out what triggered the 403 issue, though I have no idea why. We had the following piece of code somewhere which was sometimes called. As soon as it was, the MangoPay SDK would instantly stop working.
On our end we can remove this "not so safe" code anyways, but you may want to add some protection our your end to prevent possible global side effects like this one. Thanks. |
Got the same issue, I don't know yet where does it come from, using 2.5.0. |
With debugging, exact same error as @thonier
|
it looks like a cloudflare blacklist for us. |
Hello @noguespi, Are you facing this issue on Sandbox and/or Production env. ? Mickaël |
Hello @mickaelpois I just mailed your support about this issue. So it only happens on the sandbox API we don't have a production account yet. It triggers only from our dev server, I didn't faced the issue from localhost. I can reach you by mail with more technical details (IP, client ID) if you want. |
@noguespi Feel free to share some technical infos (and feel free to erase all sensitive infos). Mickaël |
Not sure how it is related to cloudflare ban, because when I restart the app, I don't get the 403. |
OK so I worked all day on it and I think I found the issue. I did try to handle and reuse the cookies (cloudflare send a __cfduid= 1 year cookie) but it didn't solve the issue. Then I refactored RestTool to isolate all the HTTP stuff and used another http client (the new java http client shipped with java 11). At first it didn't worked, because I was using it the same way HTTPUrlConnection (legacy java http client) works. It works like this : So it does create a TCP connection to cloudflare server, send a HTTP/1.1 request, close the connection. There is nothing wrong here, but I suspect it trigger a flag to cloudflare and increase your bad behavior score because an HTTP/1.1 connection is supposed to reuse the previous TCP connection for subsequent requests (it is not mandatory, and there is nothing wrong in not doing it). I have another big hint cloudflare may be using a mix of TCP layer and HTTP protocol information : when I add the "Connection: close" header, I'm blocked at the second request. See :
I think it is a cloudflare anti ddos protection which is blocking suspicious behavior. You won't be systematically blocked, it may depends on many factors like your IP reputation, the kind of request you do (POST are more likely to get blocked than GET) and many more things. Now with the java 11 client I can reuse the TCP connection (just reuse the HttpClient instance) and I'm no more blocked, but for how long ? I have yet to try an HTTP/1.0 request with a connection: close header which should be totally valid but I have to use apache HTTP client to try that. A hack would be to use the apache HTTP client and try to looks the more "legit" possible. The real problem is on your server and cloudflare. The bot mitigation/detection should be disabled, only a layer 3 protection protecting bandwith attack should be activated. Only bots and scripts are consuming the api so using a bot mitigation anti ddos looks like a big issue for me. |
I did implement HTTP interface using https://hc.apache.org/ libs with |
I get the same error when creating a new
All other calls are working fine.
|
Hi All, |
I have a strange problem: on our development machines, all calls to the MangoPay API work very well, but on our test server I get this exception for ALL calls to the API:
com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 25 path $
Would anyone know where that could come from and how to address that?
Thanks a lot!
The text was updated successfully, but these errors were encountered: