How can Meteor handle stale connections? [closed] - meteor

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I am trying to somehow handle a scenario in which I am getting a corrupted application state:
I first open the same app in two browser windows.
Turn off wi-fi (or 3g) - connection becomes stale because it was not closed from the remote server.
Perform a write operation in the first tab (the second tab will of course not update reactively).
Turn on wi-fi.
Perform a second write in the first tab (the second tab will now update reactively)
So the first tab is now in a corrupted state. The first write will never sync to the server, and if the page reloads, that change will be permanently lost.
Is there a way of handling this stale connection states? Meteor.status().connected remains true throughout this scenario. Is this a Meteor issue that needs to be resolved?

This issue has been tagged as a confirmed bug on Meteor's github page
https://github.com/meteor/meteor/issues/339

edit:
forget it, unfortunately my assumptions didnt work out :(
http://jqm.meteor.com does commit the changes when reconnecting,
but Meteor.status() indeed doesnt work on that page.
on meteor.com it does,
which is weird, because afaik the whole meteor cloud should run on 0.4.0, not only the hosted apps?
have fun
manarius

Related

Firebase Realtime Database - using onDisconnect for Presence [duplicate]

This question already has answers here:
Firebase: when onDisconnect event fire?
(2 answers)
Closed 3 years ago.
I am trying to implement a presence feature in my Firestore app, for orientation I was using the suggested google solution that can be found in the link below (hybrid solution using Firebase Realtime Database and cloud functions):
https://firebase.google.com/docs/firestore/solutions/presence
I was hoping that the .onDisconnect would fire when I lose internet connection however that only happens after about 60seconds. Is that the normal behaviour of that method or did I do something wrong? I would love if that happened much quicker than that. Any firebase people who can explain what happens under the hood here? Couldn't find anything about triggering conditions for Firebase.Database.onDisconnect. Thank you so much.
This is the expected behavior. It takes that amount of time to discern if the connection is actually lost, or instead just temporarily blocked for whatever reason. Basically, 60 seconds is the "timeout" until a read or write on the socket between your client app and the server is expected to complete.

Keep running an action after user closes broswer

I know this may not be an ideal stackoverflow question but I'm not sure where else to ask. To cut a long story short, I've built a web app running on a LAN network. The reason for this is that it is located somewhere there is very limited internet access. But there is one part of the app that needs to connect to the outside internet with Twilio.
So basically my question is, how do I get the script to keep trying to send the text message even if the user exits the session? Would some kind of cron job work or would I better off using asp.net or node.js? Or could a cgi script do it? Sorry if this is a silly question, I'm not overly familiar with how servers and all that actually work.
Thanks guys, let me know if anything needs clarifying
You can use fire and forget approach; however, it is not recommended.
Task.Run(() => StartLongRunningProcess());
Instead, you might want to consider using Background Tasks such as hangfire.
How to run Background Tasks in ASP.NET

Firebase database bandwidth usage growing rapidly even when when the database is not in use

Update: After 9 months of back-and-forth emails (over 40 emails), Google has acknowledged that they have found some bugs that may be responsible for high bandwidth usage, but bandwidth usage is still too high. Resolving this issue does no appear to be a priority for Google/Firebase (it took them 1.5 months to respond to the last email). In light of similar complaints such as: https://news.ycombinator.com/item?id=14356409, and many others, across a wide range of teams/developers, hopefully the situation will improve some day.
I'm just starting a Firebase project and have not accessed the database from any client. I have only created a single tiny test key-value pair in the database (using the console), which uses 23 B of data storage. Surprisingly, the console shows that I have used 215.9 KB (including when I was not touching Firebase at all). This number continues to grow every hour even though I am not using Firebase or even refreshing the data tab in the console!
Here is a screenshot of the console bandwidth usage chart:
Firebase console bandwidth usage screenshot
Others appear to be having the same problem, but there has been no response from Firebase/Google. What's going on? Any help would be greatly appreciated.
The usage chart takes time to update. You may be seeing bandwidth from a few minutes to a few hours ago.
Also, this reminds me of the old Google Analytics referrer issue, the default rules for firebase look something like this:
.read = true;
.write if auth != null;
This means that anyone anywhere can read from your database and that anyone authenticated(even anonymously) can write to it. It is possible since it is a noSQL database with json support that it is probably just crawlers which are the equivalent of Google Analytics referral spam.

Debugging requests which are 'stuck' in an IIS worker process

In case of TL;DR - I basically need guidance regarding what tools are available to debug requests which are issued to IIS and which stall inside a module.
I have a problem with an old ASP 2.0 app at the moment whereby it will periodically become unavailable and recycling the app pool (horrible as that may be) doesn't bring it back up 100% of the time.
So first of all it presents itself as requests entering the app pool and being trapped in state 'BeginRequest' in RewriteModule.
It is not a specific request which is always the first to experience this issue. The issue cannot be easily recreated either.
Eventually requests join this backlog and when it becomes 70+ deep the app pool fails to respond to pings from WAS and it forcibly recycles. Predictably it doesn't stop on-time and the old app pool is forced to stop. When the new app pool comes up it either works just fine or it instantly experiences the same issue as the outgoing one and requests begin to queue.
In issues like this all the official guidance is understandably focussed around looking at why the RewriteModule may choke.
I have validated my redirections and though complex there are no obvious issues with syntax (XML validates).
Likewise in inetmgr loading up the URL Rewrite Module seems to parse the configs fine and show them visually.
Basic stuff like permissions is all fine.
When the app is working normally I also used Failed Request Tracing/Logging to look at the request pipeline for a sample URL which stalled and I can confirm that there is no circular logic or weird errors presenting - the request seems to be handled just fine. This also showed me how high up the rewritemodule is invoked and from this I really don't see how the issue could be app-related as .NET isn't invoked at this point.
Annoyingly when an app pool is experiencing this issue and I can throw in requests which just stall Failed Request Tracing is no good because you actually need a request to get to the end of it's journey and fail otherwise it refuses to log anything out.
I resorted to taking process dumps of affected w3wp.exe's and running them through DebugDiag. Unfortunately the only thing I see is that threads are open accessing the rewritemodule but precious little about what they are stuck on.
As anyone else would do I've tried to track the start of the issue back to any recently installed patches or code changes but nothing matches. Likewise this is happening on 3x servers otherwise I would try reinstalling the rewritemodule. Other sites on the same server which invoke rewritemodule are unaffected.
Has anyone else experienced issues like this - the net seems to have relatively little info in this case. Perhaps you can recommend further debugging tools or approaches for IIS which I can adapt to this scenario? This is sort of a cry for help from someone more used to Apache/Nginx - sorry for the long post.

Firebase returning WebSocket is closed before the connection is established

I have an app that uses firebase for its data. Everything worked fine last night and now this morning. I am having trouble writing to a particular part of the dataset. Returning this
WebSocket is closed before the connection is established Error. I have no real connection issues and am able to read/write from other locations. https://www.firebase.com/test.html returns all looks good. Some help/direction here would be appreciated.
Ok. I will answer this in case others encounter. It turns out the firebase url which is being referenced is created dynamically and instead of a fully qualified url it was being sent "http://myapp.firebaseio.comundefined". I had disabled the initialization because I was debugging a webkit issue. Anyway. You may get this misleading error as a result of a malformed url.
-Eric

Resources