A customer of us reported a problem which I tracked down to the serialization of the Message class. The problem is that if the message is longer than the requested maximum size, the toWire method removes records from the message (i.e. the allowed truncation), effectively starting with the "Additional" section. However, this section may contain the OPT record, which represents the EDNS settings. This results in a high probability that this record is removed in the process. However, RFC 6891, section 7, last paragraph, states that if truncation occurs, the OPT record must be retained.
Attached, you'll find a fix for the problem, at your convenience.
Yes, I believe that is a bug.
The patch looks pretty complicated, though, and while looking at the existing code, I found some other problems and some other inefficiencies. I believe this patch also works, and simplifies things overall.
It passes all of the unit tests, and does the right thing when I test it. Does it work for you?