Monday, July 13, 2009

GeekSpeak: Memory Leaks in System.DirectoryServices

It rained 22 days in June (in Boston). The last few days were glorious. And I missed the sun while dealing with a memory leak.

We hit this problem while translating legacy Exchange DNs into SMTP addresses in our Exchange Room analysis tool. The culprit -- System.DirectorServices (.Net 3.5)
calls to GetDirectoryEntry().Properties. With each call to System.Directoryservices, memory use jumped by 120 bytes. The annoyance became a problem after we looked up three fields - for 8,000 users.

Microsoft's MSDN Reference says: "Due to implementation restrictions, the SearchResultCollection class cannot release all of its unmanaged resources when it is garbage collected. To prevent a memory leak, you must call the Dispose method when the SearchResultCollection object is no longer needed.".

I did that. So did other folks posted similar problems in the MS forums. All were told to use dispose. It didn't work. After reading dozens of responses, someone said try the "using" contruct along with "dispose". I did. It worked.

For those of you who don't want to find the mines by stomping on the ground, here is sample code that shows System.DirectoryServices calls broken out into an excessive number of using blocks:



'return ONE value from AD given a filter
Public Function GetADField(byval strFilter as string, _
 byval strField as string) As String
 GetADField = ""
 Using dsDir As System.DirectoryServices.ActiveDirectory.Domain = _
  System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain
    Using dsRoot As New DirectoryEntry(dsDir.Name)
      Using dsSearcher As New DirectoryServices.DirectorySearcher
        dsSearcher.SearchRoot = dsRoot
        dsSearcher.Filter = strFilter
        dsSearcher.SearchScope = SearchScope.Subtree
        dsSearcher.PropertiesToLoad.AddRange(New String() {strField})
        dsSearcher.FindAll() 'results
        Using dsResult As DirectoryServices.SearchResultCollection = _
            dsSearcher.FindAll() 'results
            Dim result As DirectoryServices.SearchResult
            For Each result In dsResult
             Using de As DirectoryEntry = result.GetDirectoryEntry()
               GetADField = de.Properties("mail").Value.ToString
               de.Dispose()
             End Using 'de
           Next 'result
           dsResult.Dispose()
           result = Nothing
        End Using 'dsResult
      dsSearcher.Dispose()
    End Using 'dsSearcher
   dsRoot.Close()
   dsRoot.Dispose()
  End Using 'dsRoot
  dsDir.Dispose()
 End Using 'dsDir
 Return GetADField
End Function



-Russ

Thursday, July 02, 2009

Bulk Move Meeting Maker to Oracle Calendar?

Keeping an eye on keyword searches that bring folks to our site usually has few surprises.

Then last month this one showed up: "bulk move meeting maker oracle calendar" (right in there with "calendar migration oracle to exchange" and "meeting maker exchange calendar convert").

Yes, Oracle does have a process to convert Meeting Maker into Oracle Calendar.

They smartly used the Meeting Maker export DAT format (just as we do - it's independent of operating system so it's the most natural format and live Meeting Maker data is a horror show of complexity).

Sidebar: Turnabout fair play with an "X" to Paul Lynde. That's the same
strategy we use to move data OUT of OCS, using the utilities Oracle provides for moving calendar data between servers.

BUT when we ran the MM to OCS conversion (a ways back when we were figuring out how to convert Oracle Calendar to Exchange), we discovered they had missed several key attributes and in general failed to impress us with their solution (we did try licensing our tech to them but they were not interested). Since their own published report example consists mainly of "Nothing to import" messages, you should be appropriately wary.

Cornell did this nice guide when they migrated out of Meeting Maker into OCS and Penn State apparently moved last year.

If you want a real geek instance of calendar comedy, check out their Troubleshooting Calendar Migration Guide for their Microsoft Exchange migration consisting largely of the equivalent of "Step 2: Discard remainder of killer whale carcass" making success seem as accessible as Larry Ellison's yacht habit.

We are surprised that anybody nowadays is considering leaving one waning calendar-only product for another waning calendar-only product.

If it works for you, that's all the matters.

As always our message is: try it out for yourself beforehand and follow Reagan's maxim of "trust but verify."

But also be prepared to migrate again in a few years.

Tuesday, June 23, 2009

Double Booking in Exchange 2003? Look to BES Versions

Gentle Reader,

As a blogging calendar geek Ms. Calendars sometimes gets requests from the field. When they are useful to the general calendar-server managing public, she publishes them.

So it has come to pass that a question came in:

You mentioned on your site about the "perennial exchange problem of double-booked meetings". I thought I would drop you a line to see if this qualifies. We have Exchange 2003 and Blackberry Enterprise Server 4.1.3. Our users run Outlook 2003. We get these periods where users claim they are getting double booked meetings. More often than not we see one as tentative and one as accepted in the same time period. Do you have a resource that clearly explains why this happens? Is BES the culprit? Thanks in advance. Rick
Double bookings are really not unusual in Outlook. Microsoft itself has a guide on How to troubleshoot missing and duplicate appointments in Outlook. It is a work of singular genius: wonderfully complete in what could be causing the problem, and mostly silent on solutions or protocols to solutions (in contrast to Russ's latest blog entry), all the while referring you to other links which will hopefully keep you from realizing you are being given the runaround.

Just because we make a good living out of working with Exchange does not mean we're going to drink the Kool-Aid or praise the manure as BBQ.

But it does advise keeping abreast of your software updates, and that did turn out to be the problem.
In the end the problem has been solved by updating to BES version 4.1.6. The release notes go over the brand new BlackBerry Calendar Synchronization Tool. And to see what effect this will have on your Exchange server, see Technical Note: Impact of using the BlackBerry Calendar Synchronization Tool. So keep an eye on your BES servers, folks.
In general, we've noticed pretty big changes going on in CDO on E2K3: see here and here. With two years of E2K7 migrations under our belt, we're encouraging folks to migrate into E2K7 rather than E2K3.
We have another report of calendar weirdness from the field, this one with BES and E2K7, which we are pretty sure is related to the known problems with cached mode and the incremental change system. We'll blog on that later.
In general, if you notice weird behavior on your calendars, start with your BES server and work back from there. BES is the source of most calendar headaches we hear tell of.

Friday, June 19, 2009

Sex Sells....but you still can't print

I attended an MSDN conference this week where I learned more about Silverlight 3. Compared to V2.0 its new features make it slicker:
  • 3D graphics are sexier;
  • Runs as a desktop app and in the browser;
  • Apps run online or offline (and run faster).
Should you consider Silverlight or WPF for your Intranet / Line of Business (LOB) apps? My take:
  • Silverlight will make a very Rich Internet App (RIA). BUT you still can't print without a major code hack, and it has basic HTTP binding (no full security).
  • If you have existing WinForm apps, WPF may be the better choice (it's a logical extension of your existing platform).
  • If you have most of your stuff in ASP.Net, then start with Silverlight (it has a small footprint, produces great cross-platform apps, and is easy to deploy).

Before you blindly walk down the path, figure out what 'features' your end users want, and then figure out which product supports those features. Here are two MSDN blogs that compare the two technologies: Jennifer Marsman (a Microsoft Developer-Evangelist) summarized the differences (although the post is a year old); The Swiss MSDN Team updates it for Silverlight 3.

-Russ

Thursday, June 11, 2009

Free/Busy not working in Outlook 2007 (Exchange 2007)

Zyg interrupted my Friday development meeting and asked why a client could not see Free/Busy in Outlook 2007, but saw F/B in OWA. He drops this on us without even bribing us with coffee and bagels. Someone says the Exchange Availability service has problems. But that makes no sense. OWA uses the availability service (pointing directly at the CAS servers). Outlook 2007 does too. Well sort of. It uses the autodiscover to find the availability service. I bet autodiscover was not correctly configured. I was wrong - it was DNS. Here is how we figured it out:

Use Outlook 'Test E-mail Autoconfiguration'
Outlook 2007 has a tool "Test E-mail Autoconfiguration" to identify the current autodiscover URLs. You can find this tool by launching Outlook 2007, then holding the Ctrl key and right-clicking on the Outlook icon in the system tray while clicking your heels together. In the form, enter an email address and password, uncheck Use Guessmart and Secure Guessmart Authentication and click Test. We looked at the log tab and saw AutoDiscover is failing -


or there was a problem with the autodiscover URL. The errors 0x800C8203 and 0x80072EE7 pointed to DNS - either DNS did not resolve the name or there was no web server at that URL. (We hope it's just a name resolution.) We checked by configuring logging in Outlook: Tools, Options, Other, Advanced, Check logging. We restarted outlook, opened a meeting, then refreshed free busy. (BTW, remember to turn off logging after you are done!) We saw:


Fix the problem in DNS

DNS. Ugh. I’d rather talk to my teenagers about sex, drugs, and the merits of doing their homework than wrestle with DNS. But the problem was simple - add a Forward Lookup Zone, then add a CNAME record. We used “DNSmgmt” (Start-Administrative Tools – DNS)

Forward Lookup Zone: Right-click on your existing forward lookup zone and select a New Zone. A wizard will walk you through the steps. The goal is to redirect ‘autodiscover.domain’ to ‘servername.domain’. You do this in five steps:

  1. Select Primary zone for the zone type;

  2. Store the zone in Active Directory

  3. Set the replication to all DNS servers in AD (this is just for internal requests)

  4. Enter the FULL NAME, e.g. autodiscover.ex2007.sumatra.local

  5. Allow both nonsecure and secure dynamic updates (this minimizes the possibility of Exchange giving you a hard time should you resign your Certificate.)

Create a new CNAME: Right-hand click on your newly created autodiscover zone and select New CNAME

  1. Browse the fully qualified domain name, traverse the DNS tree, and look for the Host (A) record in the DNS (e.g., it might be (same as parent folder).

  2. We did not add a name to the CNAME record. Click OK and you are done.

  3. Wait a few minutes until the DNS changes are sent throughout the organization.

And that worked.
-RVI

Tuesday, June 09, 2009

Oracle Calendar Migration: International Characters

As Roseanne Roseannadanna said, it's always something.

The European calendar migration business has been picking up for us lately, and Oracle Calendar is the main thing folks want to get out of. Oracle Calendar is where Meeting Maker was five years ago, but they have a larger installed base and even more irate users (Beehive did not help things).

So let's look at Jerry's calendar with this entry, a mix of German and Spanish.


Using our standard export tool on the OCS side, UNICPOUTU, this exports as:

K Events:

S 9691980

D 30

T Du mußt Amboß oder Hammer sein, Señor

I 0

R N2

M Garcia Jerry

W Garcia Jerry

A TRUE 3 10O

Which is perfectly fine.


It comes into our database correctly as:

And will insert into Exchange just as you see.

So we're pretty sure we're covered here.

But, we've had some reports of some UNICPOUTU exports not including accented characters (and they're translated to reasonable substitutions so we know something is going on). The Oracle Admin Guide section on Calendar International Support goes into fair detail on how to configure for all your various options. As always, when in doubt, check with us. We want to take as much information to your target system as accurately as possible.

Sensitive to some of the other options that might be coming down the pike, we've added a new character set option to our conversion code:

So in case we need to do Japanese or some other non-European character set we'll be able to respond.

This means the OraCalReader also has a new command line switch: /CHARSET whose values values can currently be "UTF" and "ASCII."

One additional note: Time Zones. We've been handling European and Asia-Pac time zones in OCS to Exchange migrations for years. No worries.

Friday, June 05, 2009

Script to automate Oracle Calendar Server exports

Thanks to Marco Siefert, KUTTIG GmbH, Germany for this script that he's just used on a migration from OCS to Exchange right now. It would work just as well of course for exporting in an Oracle Calendar to Zimbra migration.

No matter what I do in blogger, the indentations get screwy so I'm also putting this in the next round of migration documentation.

#!/bin/sh

export CAL_HOME=/opt/oracle/OraOcs10gHome/ocal/bin
#Set allowpasswordoption = TRUE in [UTL] section of unison.ini of OCS calendar

$CAL_HOME/uniuser -ls -format "%s%:%g%:%uid%:%id%:%node-id%:" -n 1 -p sysoppassword > users.txt
$CAL_HOME/uniuser -resource -ls "S=*" -n 1 -p sysoppassword> resources.txt
while read mylinedo
#Replacing spaces with % so it can be passed to awk

str=$myline

str=${str/\ /%}
#Declaring variables

surname=""

givenname=""

uid=""

startch=":"

endch=":"
#Launching export command with awk

echo sysoppassword awk -v str=$str -v st=$startch -v end=$endch 'BEGIN{

if (length(str)>0){

system("echo Processing line "str)
#Cutting variables out of the line

s=index(str,startch)

e=index(str,end)

givenname=substr(str,s,e-1)

surname=substr(str,e+1)

uid=surname

surname=substr(surname,0,index(surname,":")-1)

uid=substr(uid,index(uid,":")+1)

uid=substr(uid,0,index(uid,":")-1)

#Replacing % in uid for unicpoutu tool, not replacing it in givenname because that is used in the export filename

gsub("%"," ",uid)

system("echo UID="uid)

#When we have a givenname then start with export

if (length(givenname) > 0)

system("$CAL_HOME/unicpoutu -u \"UID="uid"\" -f exp-"surname"-"givenname".txt -n 1")

}

else system("echo ---------------------------------------")

}'

done <>


Reference our earlier posts on exporting data from Oracle Calendar. For example, How to Extract Data from Oracle Calendar Server for a migration into Exchange or Zimbra.

In the script the value for CAL_HOME and sysoppassword have to be replaced before running.

To provide a password to unicpoutu change the config file "unison.ini" before exporting (can be found in $CAL_HOME\ocal\misc). The line allpasswordoption = TRUE should be added to the [UTL] section.