1. A method of automatically capturing for reproduction software errors in a database query optimizer, comprising: pre-serializing input data to the optimizer before the data is used; registering, with an error handler, first capture objects that obtain relevant input data, determine the relevant input data size, and copy the relevant input data into a buffer; and obtaining information by second capture objects about optimizer thread stack traces and process details upon an error occurring, and copying said information into a pre-allocated space in a memory, wherein said information obtained by the second capture objects is serialized during optimizer processing as the information is obtained, and said pre-allocated space comprises scratch space reserved in said buffer.