Drupal xmlrpc user.login suddenly fails - drupal

I am accessing a Drupal Views feed through xmlrpc. The script has worked in the past and my goal today was solely to access another feed. In theory, there was nothing to do except to change the name of the feed. The endpoint had not changed, my domain had not changed, I can log in to the remote site so my user credentials there are valid.
I am scratching my head as to what may have changed. Is there an obvious question that I have missed? What could have changed on the Drupal end that I should be taking into account?
I can also get a session id for an anonymous user okay.
The failure comes during the complicate authentication (that has worked in the past).
Any suggestions?
Thanks.

Ah... if anyone else has the same problem, as I worked through my script, printing out its effect at each line, I came across a comment I had made when I wrote it.
Make sure the client and the remote are on the same time, preferably the time provided by www.time.is.
My PC was running a minute slow. The detafult Resynchronise on Windows 7 runs at 1am on a Sunday. Change that to a more sensible time.
And for an immediate fix, change the PC time to within a few seconds of www.time.is.
That was the problem. Authenticated login uses a time stamp. It the remote server regards your time as too inaccurate, it will reject your login. Make sure the client is running with an accurate clock.

Related

ASP.NE WEBSITE takes forever to respond

My asp.net web application is encountering down time everyday, it takes forever to respond. But once I stop and start (not iis reset) the website in IIS it will work again. Then hours/a day later it will become unresponsive again. What would be the reason? I'm suspecting an unclosed connection to database but hard to find them. The codes were made by the previous programmer.
Check the queue length which is a setting under apppool.
If its happening during a particular time of the day then please check the resource utilization like CPU/RAM consumed during that particular time.
There are APM tools like App Insight available which you can use to monitor the request response time for the requests.
You can implement Google analytics to see number of users online or requesting to see if its threshold issue.
Look into IIS logs during the time of issue and check the time-taken field. If its above normal, proceed to the following step
During the time of issue (before you restart the website), capture a manual hang dump of the w3wp process - https://blogs.msdn.microsoft.com/debugdiag/2013/03/15/debug-diagnostic-1-2-generate-a-manual-hang-dump-on-a-specific-process/
Run Debug Diag report and share it if you can. It'll tell you things that are possible going wrong.

.NET Session variable is null - for all users

Problem description
I have an ASP.NET app in which the users have different rights, and are logged in through Facebook. The app includes (among other things) filling out some forms. Some users have access to forms others don't. The forms can sometimes require some searching in books and/or on the internet before being able to submit them.
As such, we're having problems with session time-outs (it seemed), where users would be met with "Not authorized to see this page/form" after doing research somewhere else.
Attempted solutions
I've created a log function that logs the state of a handful of variables on strategic points in the application. I've pinpointed the problem to the fact that the Session variable "UserRole" is null when the problem occurs.
Relogging
The obvious solution is: "Have you tried relogging?" - which should reset the session and allow the user back to the form they want. On logout, I use
Session.Clear();
Session.RemoveAll();
and I create a new session with relevant variables (including UserRole) on login. This doesn't help, though.
Keeping session alive
One way to do it is just increase the standard 20-minute Session length to an arbitrary, higher number (say 2 hours). Although that could be viable during beta (there are only around 5 users right now), it is not a viable solution in the long haul as the server would have to keep the Session objects from many users for longer time, exponentially increasing server demands.
Instead, I created a 'dummy' .ashx handler "RefreshSession.ashx", that can recieve a POST request and return "200" statuscode. I then created a jQuery function in the shared part of the app (that all the pages use) that calls this handler every 10 minutes in order to refresh the session as long as the tab is open in the browser. I've checked the network traffic, and it works as intended, calling the handler even if the window is minimized or the user is viewing another tab. This did not solve the problem either.
A caveat
When one of the users encounter the problem, they call me or my programming partner up. Of course, we go and see if we get the same issue. We all have the same (admin) rights. The 'funny' thing is that we see the exact same error on the same subpage - even if we haven't had any contact with the application for days.
The problem will 'fix itself' (i.e. let users with proper role back on the subpage) after a while, but not even republishing the app to the server will reset it manually.
Therefore, it seems to not be a simpel session error as supposed from the "UserRole" session variable being null after 15-20 minutes of inactivity. It seems to be saved somewhere internally in the server state.
My problem is, that I now have no idea where to look and how to progress. I was hoping that someone here might have an idea for a solution, or at least be able to point me in the right direction? :-)
Thank you all for your time, it is much appreciated.
Based on MaCron's comment to the question, we decided to keep the information in the user's cookies instead of the session variables. Everything seemed to point to us having exactly that issue, and deadlines being deadlines and with me not being able to figure out how to disable the synchronization of worker processes, this seemed to be a feasible and comparatively easy fix.

Checking server status?

Is there a way to check the status of the Nest servers?
They appear to be down right now. Currently I'm checking by firing a GET request to:
https://developer-api.nest.com/?auth=...
Which works fine, I can just set a timeout and check the status codes.
I'm using the Firebase API (OS X) and I'm wondering, maybe there is a better way I can check? I don't see anything in their API. observeEventType:withBlock:withCancelBlock: never gets called.
Also, will the firebase observeEventType: block automatically start being called once the servers are back?
After 2 days the block appears to be lifted. I tried contacting Nest 2 days ago and I never got a reply. Perhaps they lifted the block and didn't reply, or it happened automatically.
I believe I was blocked because I was using my real account, with a real device. And obviously because I was in development I was logging in/out and changing values a lot.
I didn't realise until after the block you can create virtual devices (on a new account). More information here: https://developer.nest.com/documentation/cloud/chrome-extension
Moral of the story: use virtual devices!

Asp.net slow first load per user

I have a website set up with in IIS 7 with HTTPS, and every time a user access it for the first time the load time is about 15 sec.
THIS IS NOT the compile/warm up "problem" described for instance her: Slow first page load on asp.net site
I know about that "problem" and I also have that, but that is of course expected and not the issue here.
Since it's not when the application loads first time since recycle/start. If I open another browser and access it after doing it first in another browser then it takes the same amount of time. So it seems every time a session is started, that's when the delay happens. All following requests from the same user/browser is as quick as expected.
This is for an admin interface site I have and I use asp.net membership. Although the delay happens even before the user have logged in. So I'm not sure if that is the culprit.
I am a bit unsure where to look for killing the delay. I am running session state in process. With cookies.
Any ideas?
You need to get a little more information. Enable trace and track how long each step takes. You could also use Wireshark and have a look at the traffic between the client/server. If there is a big gap in traffic you can see something is hanging at the servers end. If you see constant traffic perhaps you have to much going on with your landing page. Other simple things to do would be to enable dynamic caching/compression on the server to speed things up.
Warm it up...
http://learn.iis.net/page.aspx/688/using-the-iis-application-warm-up-module/

Web Services error on first attempt only

I've created a Web Service which is accessed by 3 other websites. In 1 instance, after user entered some data and click a submit button it goes off and does it's thing and return true or false.
The problem is when i click submit initially (after a period of inactivity) i get the error
"The remote name could not be resolved: (mydomainname.goes.here)"
However, if i clicked the submit button immediately after, it works fine, and will work again until another period of inactivity.
Any suggestions where to begin.
EDIT: New data - I was ready to accept it being a DNS issue at the server site since i tested it from 2 locations (home and office with different ISPs) and the problem seemed consistent, however at the last minute i tried it from my sprint cellular data connection and never has this issue. The web service responds and works well everytime i try it here, regardless of the time that has elapsed between trials. - So i'm doubtful that it's DNS issue again.
The remote name could not be resolved
Something wrong with your DNS/proxy configuration
I've run into a similar problem before when calling web services on Apache from a .NET CF client. Try turning KeepAlive off on your web service client, sounds like a very similar pattern compared with what I was seeing. The web service call would work on the first try, fail if there was an interval of around 10 seconds between calls, and work every time if there was a 1 second interval. I think it was a problem with the Apache configuration.

Resources