September 3, 2005
Progress on the ConstrainException?
A very few customers are getting ConstraintException after running send/receive. I am having the worst time tracking this one down. First of all, it only happens for 3 (so far) customers, but not for me. Second, it seems to go away when I start looking for it.
The error occurs when a new shipment from the store is being merged into the list of shipments on the customer’s computer. The error means that either the shipment, the items, the item attributes, or item gift wraps are not unique. At first I thought maybe the code that handles backorders was not working…but no…no backorders. Then I thought maybe I made a change that broke attributes or gift wrap…but no…test orders with attributes and/or gift wrap worked fine.
So finally I decided I would add code that would validate all the constraints before the point where the error occurs. Wouldn’t you know it…the error disappeared…at least so far…and at least for the two people that have installed the code. This is so frustrating. My current guess is that it is a timing issue. I think the affected customer’s computers are checking the constraints *during* the merge (while it is partially complete).
Old Code
- Signal the beginning of the merge (speeds up the merge).
- Merge the data.
- Signal the end of the merge (enforces the constraints). This is the were the error occurs.
New Code
- Signal the beginning of the merge.
- Merge the data.
- Check all the constraints.
- Signal the end of the merge.
What might be happening is this…there are other parts of Shipper that are watching for the data to change. They are watching for changed events. A lot of changed events are raised in step 2. I’m thinking the watchers are still running when step 3 is reached. In the old version this confused the code (Microsoft wrote) that enforces constraints, but it does not confuse the code (I wrote) that pre-checks the constraints. By the time constraints are enforced in the new version, all of the watchers are done.
Unfortunately, it is probably impossible to be sure. Now I have to decide how to handle this. I could leave in the “debugging” code, but that seems bad. I could remove the beginning and end signals. This would slow down the code slightly (the debugging code slows it down more), but then constraints would be enforced one shipment at a time, but might be less confusing to the watchers.
If you are getting this error, but have not reported it, please feel free to install the version described above:
Shipper 1.1.4 RC3
Now playing: George Winston - Young Man's Fancy
This site looks much better in a browser that supports current web standards, but it is accessible to any browser.
Download one now
Some parts of this site will not work effectively on this older browser.
Please consider
updating your browser