Closed Capybara-1 closed 1 year ago
Right Bytes : [10 49 10 5 102 117 99 107 50 18 40 10 38 10 29 116 121 112 101 46 103 111 111 103 108 101 97 112 105 115 46 99 111 109 47 112 98 46 83 116 114 105 110 103 18 5 10 3 102 102 102 10 60 10 5 102 117 99 107 49 18 51 10 39 10 29 116 121 112 101 46 103 111 111 103 108 101 97 112 105 115 46 99 111 109 47 112 98 46 83 116 114 105 110 103 18 6 10 4 102 102 102 49 16 184 141 198 182 161 225 134 161 23 10 80 10 4 102 117 99 107 18 72 10 60 10 28 116 121 112 101 46 103 111 111 103 108 44 34 65 50 34 58 34 50 34 44 34 65 51 34 58 51 125 16 136 195 177 235 210 200 134 161 23 10 49 10 5 102 117 99 107 50 18 40 10 38 10 29 116 121 112 101 46 103 111 111 103 108 101 97 112 105 115 46]
Bad Bytes: [52 50 51 52 125 13 49 44 50 44 51 44 52 44 53 44 54 44 55 195 10 60 10 5 102 117 99 107 49 18 51 10 39 10 29 116 121 112 101 46 103 111 111 103 108 101 97 112 105 115 46 99 111 109 47 112 98 46 83 116 114 105 110 103 18 6 10 4 102 102 102 49 16 136 195 177 235 210 200 134 161 23 10 80 10 4 102 117 99 107 18 72 10 60 10 28 116 121 112 101 46 103 111 111 103 108 101 97 112 105 115 46 99 111 109 47 112 98 46 66 121 116 101 115 18 28 10 26 123 34 65 49 34 58 34 49 34 44 34 65 50 34 58 34 50 34 44 34 65 51 34 58 51 125 16 136 195 177 235 210 200 134 161 23 10 49 10 5 102 117 99 107 50 18 40 10 38 10 29 116 121 112 101 46 103 111 111 103 108 101 97 112 105 115 46]
This happens the second time I call this function, the bytes will be modified
The above code is an anonymous function, so it is not called continuously
Please make "minimal reproducible example".
I find this is XORM issue.
sql.RawBytes must not be used after rows.Next()
or rows.Close()
is called.
If you want to use data, you need to copy the data before calling rows.Next()
or rows.Close()
.
This is dangerous default.
I reported it to xorm/xorm#2217.
Issue description
When I use XORM, there is a data competition detection error.
The underlying database driver of XORM is this project.
Example code
In the above code, go fun is the goroutine I use to test and open according to the basic understanding of sql.Table(src). Find(&result) This code should be returned after the query, not asynchronous, then multiple fmt.Println(result[0]["cache"]). The field will be changed (field type[]byte). The result after the change is about the residual data of the previous field, but there is no data error in the previous field.
Error log