cachedependancy files not being created

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
3/21/2012 3:11:00 PM
Gravatar
Total Posts 130

cachedependancy files not being created

Hello,

I just became aware that my mojoPortal installation is no longer creating cache dependency files ... has anyone else encountered this before? I've deleted the cache dependency files that were existing in one site directory, then created a page, deleted it, and no new cache dependency files were created. This is problematic for sites in my installation that are in a clustered environment ... the entire Sites directory is in a file share location. If a person makes a change to the site on one server and the cachedependency isn't getting cleared, the new pages/changes are not being reflected on the other server.

I've checked the logs and am not receiving any errors after making a site change (such as the failure to create the file).  Any ideas???

Thanks,

Beth

3/21/2012 3:40:46 PM
Gravatar
Total Posts 130

Re: cachedependancy files not being created

I also wanted to add that I checked my file permissions on the systemfiles directory and they are correct and the application has write access. ~ Beth

3/21/2012 4:25:30 PM
Gravatar
Total Posts 18439

Re: cachedependancy files not being created

Hi Beth,

I'm afraid this is my fault. One of my goals when working on web farm support was to do away with the cache dependency files since they could not be used in large web farms. Currently they are not needed on a single server, and on large web farms we support using a distributed cache (AppFabricCache) which allows the cache items to be cleared by any node in the farm.

However in doing this I kind of lost sight of the small cluster with a shared drive scenario, since I don't imagine you'd like to setup an AppFabricCache given that it has been working for you all along in the past, I'll look into adding a config setting that allows re-enabling use of dependency files, I don't think it will be too difficult or take too long to solve that.

I'll follow up tomorrow and try to get a solution for this into the repository asap. Sorry for the inconvenience.

Best,

Joe

3/22/2012 8:25:39 AM
Gravatar
Total Posts 130

Re: cachedependancy files not being created

Ok, thanks.  Let me know :-) ~ B

3/22/2012 8:55:14 AM
Gravatar
Total Posts 18439

Re: cachedependancy files not being created

Hi Beth,

Ok, this is in the repository now. You'll need to do the usual pull changes, update working copy, rebuild solution, visit setup page.

Then add this in user.config:

<add key="UseCacheDependencyFiles" value="true" />

and touch web.config to make it load the new setting from user.config

After that you should see cache dependency files under /Data/systemfiles

Whereas before we stored some of them under /Data/Sites/[SiteID]/systemfiles, now they will only be in /Data/systemfiles

Best,

Joe

3/22/2012 9:39:56 AM
Gravatar
Total Posts 133
J

Re: cachedependancy files not being created

Cool Excellent

3/28/2012 12:57:02 PM
Gravatar
Total Posts 130

Re: cachedependancy files not being created

Hi Joe,

After pulling down your changes, I've tried upgrading from 2.3.7.6 to 2.3.8.1. The upgrade completes but I am unable to log in.  I see no errors in the log file and everything appears to be correct in the database (I'm not locked out).  I've tried changing my password directly in the database and still cannot log in through the web interface. I've updated my machine key prior to running the upgrade to make sure I didn't garble the passwords.  Any suggestions?

~ Beth

3/28/2012 1:15:39 PM
Gravatar
Total Posts 18439

Re: cachedependancy files not being created

Hi Beth,

What password format are you using?

Is this your dev environment using source code from the repository? The very latest code should be version 2.3.8.3, it doesn't sound like your working copy is updated to the latest code which is needed for the cache dependency files. I would first get your code up to the latest version by right clicking the top level folder and choose TortoiseHG > Update (default branch), then rebuild the solution and visit the setup page, it should have version 2.3.8.3.

Though nothing changed in terms of login since version 2.3.8.1 which is the version where we updated to stronger hashing and encryption with salt.

You can't really manually update your password in the db unless using plain text, since it would be stored as hashed or encrypted otherwise and you have no way of manually doing that.

There is a safety net setting you can put in user.config that will make it try all password formats if login fails:

<add key="CheckAllPasswordFormatsOnAuthFailure" value="true" />

and that would allow you to manually update it in the db to plain text (even when using encrypted or hashed) to get back in but you should not have to do that, so I would save that as a last resort and it won't really be a solution for lots of users if they are all failing.

With hashed or clear text the machine key does not matter but with encrypted it must never change, if the machine key is changed after passwords are encrypted then all users would be locked out and no way to recover the password. machine key on your dev environment needs to be that same as on production if using encrypted.

On your dev machine you could step through the code, setting a breakpoint in Web/Components/mojoMembershipProvider.cs in the ValidateUser method and in PasswordIsValid method and find out what is happening

Hope that helps,

Joe

3/28/2012 2:44:30 PM
Gravatar
Total Posts 130

Re: cachedependancy files not being created

Hi Joe,

I'm using the hashed password format. I've compiled the site from the full source in the repository. My last pull was on Friday after you released the updates ... When was 2.3.8.3 released?

I set break points as you suggested and the system is interpreting my password as the wrong hash.  My password is correct but the hash doesn't exist in the db at all.

Any ideas?

~ Beth

3/28/2012 2:46:11 PM
Gravatar
Total Posts 130

Re: cachedependancy files not being created

Also I did another pull from your source code before I went through the steps you suggested just now. ~ Beth

3/28/2012 3:05:05 PM
Gravatar
Total Posts 130

Re: cachedependancy files not being created

... I ran the application in debug mode again, this time pointing to a database that hasn't been upgraded (so it's 2.3.7.6) and am throwing an exception at log in: IndexOutofRangeException was unhandled by user code at line 926 in SiteUser.cs:

 rolesChanged = Convert.ToBoolean(reader["RolesChanged"]);

I don't know if that is helpful or not.

~ Beth

3/28/2012 3:32:11 PM
Gravatar
Total Posts 18439

Re: cachedependancy files not being created

Hi Beth,

There has not been a release of 2.3.8.3. A release is when I compile a build and make anew package of pre-compiled files for people to download. The source code repository is always the latest code, the version number corresponds only to changes int the database schema, ie new upgrade scripts are added with incremented versions every time I need to make any changes in the database. So currently in the repository the database is up to script 2.3.8.3 but other changes will be made before the next official release is packaged, amd possibly I will even need to make additioanl changes in the database and increment the upgrade script again before the next official release. But if you are using the latest code you should see the version as 2.3.8.3 since that is the most recent upgrade script in the repository.

Of course there will be errors expected if you run the latest code without running the upgrade scripts. New fields like "RolesChanged" get added by upgrade scripts and the newest code expects the new field, so the code and the database have to be in sync and that is what the setup page does it runs the scripts to upgrade the database to get it in sync with the latest code.

I'm not really sure what is going on, hashed password don't depend on the machine key so that isn't a factor.

My password is correct but the hash doesn't exist in the db at all.

What do you mean by that? Your password is correct where? in the database?

If using hashed passwords you will not see the password in the database you will only see the hash. The password field in the database is pwd not Password in case that is throwing you off. The Password field is a legacy field (no longer used) it was too small for the stronger hashing and stronger encryption so we migrated quite a while back from the Password field to a larger field Pwd. That change of fields was many versions ago, but we finally took advantage of the larger field in 2.3.8.1 when we implemented the stronger hashing.

The way it works with hashed password is the password you enter on the login page is concatenated with the value from the Password salt field then hashed and then the hash is compared to the hash in the pwd field, if it matches the password is correct.

We changed from MD5 hash with no salt to SHA512 hash with salt. Salt is just a random string concatenated with the password before hashing, it is stored in the PasswordSalt field. Its purpose is so that people who happen to use the same password don't have the same hash.

So when you try to login it is first trying to use the sha512 hash but if that fails it falls back to trying the old md5 hash (with no salt) so that it won't break any logins during upgrade. So I don't see how the change to stronger hashing could posisbly cause a login failure. Something else is going on here but I'm not really sure without being able to debug it myself.

If you want to email me a database backup and tell me a user name and password that should work I could try to debug it for you tomorrow, but I understand if you don't want to do that for data security reasons.

Best,

Joe

3/28/2012 3:49:31 PM
Gravatar
Total Posts 130

Re: cachedependancy files not being created

When using break points in Visual Studio when I get to the HashedSha512PasswordIsValid method I can see my text password in the Visual Studio Console, and know it to be the correct password.  What I see in the db is hashed. I'm looking at the Pwd column and ran a query searching for the hash that has been interpreted by the application, and that hash is not present in the db at all. So it appears that the application is interpreting the text password incorrectly.

I pulled the latest version from your repository and upgraded a test db to 2.3.8.3 and am still having the same issue.

Tomorrow I could export the db and remove/change credentials so you can have something that is pre-upgraded, working, and not a security issue.

Thanks,

~ Beth

3/28/2012 3:55:26 PM
Gravatar
Total Posts 130

Re: cachedependancy files not being created

ooooh I just realized that the hash IS being read correctly. The sha512Hash is what I was originally looking at, and it is a value I do not recognize. In the Visual Studio "Autos" window (while debugging) the siteUser.Password value is the correct hash. At line 1681 of the mojoMembershipProvider.cs  if (sha512Hash == siteUser.Password) {  return true; } it is returning false ... so isValid is returning a false value. Which is in turn returning a false value to result.

3/28/2012 4:06:24 PM
Gravatar
Total Posts 18439

Re: cachedependancy files not being created

Hi Beth,

At line 1681 of the mojoMembershipProvider.cs if (sha512Hash == siteUser.Password) { return true; } it is returning false

That would be expected since the current rows have an md5 hash, but when it returns to line 1516 as false it should next check using md5 at line 1518

Best,

Joe

3/29/2012 3:35:16 PM
Gravatar
Total Posts 130

Re: cachedependancy files not being created

Hello,

The issue was that "CheckMD5PasswordHashAsFallback" was set to false in the user.config when it should have been set to true.  After making that change the app was able to update my hash to salt and I can now log in (yay). Now to begin testing ....

~ Beth

You must sign in to post in the forums. This thread is closed to new posts.