Possible Firebase bug with .onDisconnect() when running Opera? - firebase

First off I apologize if there has already been a similar question before, I honestly couldn't find any.
I'm currently developing a chat using Firebase and thanks to the decent docs I'm making good progress so far, so this isn't really the issue here. However, while testing I stumbled across a little issue that might possibly be a bug.
For managing presence in my chat, I am pushing values to a location that corresponds to my user's unique ID. This pushed value is then removed on disconnect.
By doing it this way, I can reliably determine a user's status without worrying about his number of concurrent connections to my Firebase (i.e. browser tabs).
This is actually working fine with Firefox, Chrome and Safari, but there seems to be an issue with Opera. When using Opera, if you close the tab in which the chat is running, the value that should be removed on disconnect is not. It will be removed eventually after like 2 minutes or so, but it is taking way too long, considering that the same thing is happening instantaneously when using another browser.
Out of curiosity I've tried the presence example using Opera and I was able to reproduce the exact same behavior. If I open the corresponding Firebase in another tab, then run the example, enter a name and finally close the tab that the example is running in, I can see that the value in the corresponding Firebase is not removed as I close the tab.
I would appreciate if you could tell me if this is just me doing something wrong or if it is actually a bug.
Regards
Muddy

Opera has a different model for page transitions than all other browsers. Most browsers fire events when loading and leaving a page. Opera actually keeps old pages hot in memory in order to make the back button faster. When you click "back" in opera it's actually resuming the old page.
As a result, there's no way for us to know exactly when someone has left a page in Opera. As a result, we're forced to simply wait for a server timeout to determine someone has left.
So, short answer, onDisconnect operations DO work in Opera, but they might take a couple of minutes to take affect. In all other browsers the operations will happen immediately if the connection was terminated cleanly, and after a few minutes if it was not.

Related

Chrome shows RESULT_CODE_INVALID_CMDLINE_URL when other Chromium browsers work fine

I'm writing a WP plugin that makes changes to tags and categories. After making my selections and submitting the form, the page reloads and executes wp_set_post_categories and/or wp_set_post_terms.
It works fine even in other Chromium based browsers, but when I try it in Chrome, it throws the following error:
Error code: RESULT_CODE_INVALID_CMDLINE_URL
There's a "Learn more" link, but nothing happens when I click it.
After refreshing the page, I can see that my script did what it was supposed to do, but I'd like to eliminate this error if possible.
I found this support page about the error code, and I turned on logging to see if that would give me any clues, but I don't really know what to look for.
Please let me know if there is any additional info I can add that might lead to an answer. Thanks!
I don't know what might have caused your problem, but I know a problem that causes this error. So even if it is too late someone may benefit from it. I found your question when I was answering a related problem here. you can read it if you want, but in short this happens when an array of length infinity is created. (like a
stackoverflow
). If you want to regenerate such an issue you can use this js code below.
let arr = [];
let arrcounter = 13;
for (let x = 1; x <= arrcounter; x) {
arr.push(x);
}
This is an infinite loop that adds an element to an array.
This might not be your exact problem, but I hope this helps.
I was running into this problem too, and I found in the end that my web app was running out of memory. So #EHM is right - an infinite loop that keeps adding to an array will eventually run out of memory and cause this issue.
But in my case, it was running out of memory because the js heap was not getting cleared after each page refresh. For testing purposes, I was running a puppeteer script that refreshed the page many times, and after 40 or so refreshes it would crash with the RESULT_CODE_INVALID_CMDLINE_URL error.
I'm not sure why chrome was not clearing the heap between refreshes, but this type of issue has been reported before under certain conditions, see this issue: https://bugs.chromium.org/p/chromium/issues/detail?id=113983.
Without digging too much here into why it can happen, I will post here how to detect if your memory is getting out of control. You can use the chrome dev tools performance monitor, a built-in part of chrome dev tools:
The official docs on the performance monitor are here: https://developers.google.com/web/updates/2017/11/devtools-release-notes#perf-monitor
In case that link stops working, here are the basic steps:
Open chrome dev tools while on your web site with a memory issue
Press cmd-shift-P to open the command palette. Search for "Performance Monitor"
Once the perf monitor is open, watch the heap size in real time. While watching the heap size, reproduce the condition that causes the RESULT_CODE_INVALID_CMDLINE_URL. You should see the heap size gradually increase until the error occurs.
Now that you can see the memory leak happening, try to isolate what part of your code is causing a memory leak. Chrome dev tools has other tools to record heap usage and isolate which objects are being allocated. You may have an infinitely growing array, like #EHM mentioned, or a number of other issues. In my case, Chrome didn't seem to be releasing certain DOM nodes between refreshes. I was able to fix my script by navigating to a different domain between refreshes, which caused chrome to correctly release all the DOM nodes. To learn all about finding memory issues in chrome, read their article on the topic here: https://developers.google.com/web/tools/chrome-devtools/memory-problems

Firebase database node property value getting truncated in Chrome, Edge

Started working on Firebase database just recently, and node property value is getting truncated.
Which is why sometimes, it's difficult to understand the type of value.
For e.g. the below value are all strings, however, since the ending quotation is not showing, it's confusing.
Also one value is not fully visible.
Chrome: 72.0.3626.121
Edge 42.17134.1.0
Looks OK in Firefox 65.0.1
Windows 10 64-bit
Is this a browser issue? I'd like to work with Chrome.
This indeed looks like a browser-specific rendering issue. I have it in Chrome too occasionally, but aren't too bothered by it (since the data is stored correctly).
It might be worth filing a bug report, so that the UI engineers who build this know that this occurs on a specific browser.

Desactivating a setinterval function?

I have absolutely no idea why, but on 2 websites (2 websites that I professionnaly work on, and they havent been hacked or compromised), my Chrome console keeps clearing every 500ms.
Which is pretty annoying.
I desactivated all extensions. Tried private browsing. It's the same thing.
I uninstalled chrome as well as my extensions. Same.
When I try to reproduce it on someone else's computer, I cannot.
When I use another Chrome session the issue does not happen.
I have absolutely no idea how to get rid of this or what is the exact cause of the issue.
The code running is :
setInterval(function(){console.clear();console.info('Console was cleared by browser extension.');},500);
Since I unfortunately do not seem to find the reason, my only question will be : would there be a way to desactivate that code or postpone the setinveral to a bigger number?
Thanks !
In Chrome, on the developer tools, click on the settings icon, and tick the the "Preserve Log" option so the console is not cleared.
If your websites happen to be ecommerce (Magento specially) I'll advice you to check your code well for unknown js. This is one of the "symptoms" of the Magecart credit card skimmer. Preserve log option

Bug with fIrebase database web viewer [duplicate]

When I try to delete or edit a node in my realtime database, I always get the info that I have to select a key with lesser elements to change something, else it is in read-only modus.
But when I click a low level node, nothing happens. So I actually can change nothing in my DB from console :(
A week ago I didn't see this warning and everything works great!
Any idea how I can get back to working version?
I also think the german translation is not very good, because it tells me that I should activate another mode. In English it says, that the mode got activated.
You're mixing three things here:
Your database console switched to read-only mode, which happens when you have a certain amount of data under it.
The warning is badly translated. Please file a bug report for that.
The database console doesn't handle clicks correctly anymore. I already reported that internally last week, and added your report to it. This bug has been fixed internally and will go into production by May 23.
Update 5/24/17:
Problem resolved. Works now.
It seems the ability to click on a child node and promote it to be the top element of the tree is broken. Doesn't work for me either, even on a small database that is not in Read-only & non-realtime mode. I'm almost sure it was working a day or two ago.
I'm seeing the failure when using Chrome. Just tried Internet Explorer. Its works there.

Flex: Controlling browser statusbar

My application has to call server several times per one second (to check if position on board changed or not). I didn't find anything better for now then implement a timer and call server so often to check if something was updated (actually only small amount of data is sent so I think nothing bad will happen). Anyway some browsers like firefox, shows in status line something like "Transferring data...", and the text which flicker there is annoying.
I wonder if there is a way to control the status line from the flex application?
There's nothing you can use out-of-the-box in Flex (or Flash, for that matter) to control the status bar, you need to use JavaScript for that. Communicating Flash and JS is easy, just take a look to ExternalInterface.
Problem is this never ending "Transferring data" message in Firefox, it's annoying as hell, and I still haven't found how to get rid of it. I was once told sending some specific headers would do the trick, but just didn't fully work for me at that time.
I'd love to hear a definitive answer on this one as well.
Juan

Resources