Open rromanw opened 3 years ago
When I ignore this error like this:
diff --git a/facebook/facebook-api.c b/facebook/facebook-api.c
index b452ccd..3aa3f74 100644
--- a/facebook/facebook-api.c
+++ b/facebook/facebook-api.c
@@ -2105,6 +2105,8 @@ fb_api_error(FbApi *api, FbApiError error, const gchar *format, ...)
void
fb_api_error_emit(FbApi *api, GError *error)
{
+ printf("An error occurred, we will consume it\n");
+ return;
g_return_if_fail(FB_IS_API(api));
g_return_if_fail(error != NULL);
Bitlbee works fine. Not sure, what the graphql query is trying to accomplish but simply removing it could solve the problem?
I fixed the problem locally with the ugliest patch. It also contains code that kinda mitigates (in a horrible way, include unistd and sleep(2) ) the #73 mega annoying bug. If someone feels like fixing this in a proper way, here is the patch for some hints:
diff --git a/facebook/facebook-api.c b/facebook/facebook-api.c
index b452ccd..7c6ebda 100644
--- a/facebook/facebook-api.c
+++ b/facebook/facebook-api.c
@@ -18,6 +18,7 @@
#include <bitlbee.h>
#include <stdarg.h>
#include <string.h>
+#include <unistd.h>
#include "facebook-api.h"
#include "facebook-http.h"
@@ -687,20 +688,26 @@ fb_api_json_chk(FbApi *api, gconstpointer data, gssize size, JsonNode **node)
root = fb_json_node_new(data, size, &err);
FB_API_ERROR_EMIT(api, err, return FALSE);
- values = fb_json_values_new(root);
- fb_json_values_add(values, FB_JSON_TYPE_INT, FALSE, "$.error_code");
- fb_json_values_add(values, FB_JSON_TYPE_STR, FALSE, "$.error.type");
- fb_json_values_add(values, FB_JSON_TYPE_STR, FALSE, "$.errorCode");
- fb_json_values_update(values, &err);
+ // it would have to be error.code and error.message, it has different format
+ if (strstr(data, "An unknown error occurred")) {
+ code = 1;
+ str = "An unknown error occurred";
+ } else {
+ values = fb_json_values_new(root);
+ fb_json_values_add(values, FB_JSON_TYPE_INT, FALSE, "$.error_code");
+ fb_json_values_add(values, FB_JSON_TYPE_STR, FALSE, "$.error.type");
+ fb_json_values_add(values, FB_JSON_TYPE_STR, FALSE, "$.errorCode");
+ fb_json_values_update(values, &err);
- FB_API_ERROR_EMIT(api, err,
- g_object_unref(values);
- json_node_free(root);
- return FALSE
- );
+ FB_API_ERROR_EMIT(api, err,
+ g_object_unref(values);
+ json_node_free(root);
+ return FALSE
+ );
- code = fb_json_values_next_int(values, 0);
- str = fb_json_values_next_str(values, NULL);
+ code = fb_json_values_next_int(values, 0);
+ str = fb_json_values_next_str(values, NULL);
+ }
if ((g_strcmp0(str, "OAuthException") == 0) || (code == 401)) {
errc = FB_API_ERROR_AUTH;
@@ -719,6 +726,16 @@ fb_api_json_chk(FbApi *api, gconstpointer data, gssize size, JsonNode **node)
success = FALSE;
}
+ if ((code == 1) && strstr(str, "An unknown error occurred")) {
+ fb_util_debug_info("Ignoring 500 error which occurs 30s after connect hopefully...\n");
+ errc = FB_API_ERROR_NONFATAL;
+ success = FALSE;
+
+ fb_api_error(api, errc, "%s", str);
+ json_node_free(root);
+ return FALSE;
+ }
+
str = fb_json_values_next_str(values, NULL);
if ((g_strcmp0(str, "ERROR_QUEUE_NOT_FOUND") == 0) ||
@@ -2173,7 +2190,7 @@ fb_api_attach(FbApi *api, FbId aid, const gchar *msgid, FbApiMessage *msg)
prms = fb_http_values_new();
fb_http_values_set_str(prms, "mid", msgid);
fb_http_values_set_strf(prms, "aid", "%" FB_ID_FORMAT, aid);
-
+ sleep(2);
req = fb_api_http_req(api, FB_API_URL_ATTACH, "getAttachment",
"messaging.getAttachment", prms,
fb_api_cb_attach);
I think ThreadListQuery is for listing groupchats
When connected to server, exactly after 30 second I receive " facebook - Error: An unknown error occurred".
When debugging and putting breakpoint into
fb_http_request_send
after third hit after the connect it makes this graphql request:After sending this a large debug log is printed about parsing some data from server. I just picked a few lines that might be useful (don't know what exactly is happening).
Ultimatelly this appears in the log, seeming that the original request fails:
My guess is, that the plugin tries to get some status information that is too big and the server refuses to serve it, which in response causes the plugin to end the session and reconnect. This doesn't happen the whole time, sometimes the plugin works just fine half a day or something like that.
Any idea, what might be wrong?