torsdag den 18. juni 2015

The case of WFFM going double escaping

This one is quiet interresting - a while ago, we had a customer which wanted to use the Send Email save action in WFFM.

They had designed the form with several fields, including a field called Mail, in which the user should enter their email address.

In the save action, they had selected the Mail field in the CC section, so the user would be CC on the mail that got send out.

The way this works, is when you insert a field into here, it is wrapped with square brackets, so it becomes [Mail] .

Now, when they clicked OK to close the save action, and opened it again, Sitecore had changed it to [[Mail]], which made it fail with an exception when the user filled out the form.
Changing it back and saving made not difference, since it kept changing it to [[Mail]].

We contacted Sitecore Support, and got a fix for it - so if you run in to this issue, please contact them, and say you want the fix from issue #436119.

The version we had the issue with is 2.3 rev.140617, so if you are using another version, it might work for you without the fix.

Insert Media Link in General Link breaks if parentheses is used

In Sitecore 6.6 (the issue is fixed from 7.0 and forward), there is an annoying bug, that causes the Insert Media Link dialog, if parentheses is used in the link description or the alternative text.

Here is how to reproduce it:
  1. Install Sitecore 6.6 rev. 140410
  2. Create a template with a general link field.
  3. Create an item based on this template.
  4. Click Insert Media Link, and select a media item.
  5. Enter a link description and alternative text containing parantheses, and click OK to close the dialog.
  6. Click Insert Media Link again, and watch the "Value cannot be null" exception.
If you happen to run into this issue, there is a workaround you can get from Sitecore Support - just contact them, and ask for the fix given out in the issue #434185 .

It is a small DLL and a zip file, so nothing fancy - but none the less, it works.

The case of the test server with 500MB/s reads from the web database MDF file

First, let me describe the environment.

We have these servers:

SERVER-CM, which is the sitecore content management server.
SERVER-CD, which is the sitecore content delivery server.
SERVER-SQL, which is the MSSQL server containing the databases.
SERVER-TEST, which is the test server, containing both the test databases and the test sitecore instance.

Now, when the site was developed, it was deployed to both the production and the test environment, and changes was applied both places when we make changes.

Time went by, and we had to upgrade the site, so we thought it would be a good idea to upgrade the production environment, make a copy of it, and overwrite the test environment with this copy, since it still contained the original test data, which made it difficult to test some changes, since there was no real data.

So, we upgraded the production environment, and made the copy.

The production environment performed fine, but the test environment all the sudden has a constant load of several hundred MB/s reads from the web database.

After alot of debugging, profiling and staring into the screen, we found the cause.

It turns out, when staging is enabled, everything that needs to get done on all servers is written as events into the EventQueue table in the web database - and also which instances of Sitecore that has run these events. (The EventQueue table is meant to be trimmed every 4 hours, but for some reason that does not happen, but thats another issue).

So, when all the sudden the test instance sees a copy of the web database from production, it sees 1.3 million event records that it needs to go through and replay, since it thinks it never has run them (even though it has, since it is a copy of an instance that has).

After we truncated the EventQueue table in the web database and restarted the IIS process, the database I/O went normal instantly, and performance seems to have improved.

So, if you clone an production environment into a test environment, and staging is enabled, make sure to truncate the EventQueue tables.