Closed seymores closed 8 years ago
Hi, So I dig a little further and found the likely culprit -- turns out I have my old elasticsearch plugin config with me and they could be causing the problem I described above.
I am including it here in hope it will help someone in the future.
elasticSearch { /* * Date formats used by the unmarshaller of the JSON responses / date.formats = ["yyyy-MM-dd'T'HH:mm:ss.S'Z'"]
/**
* Hosts for remote ElasticSearch instances.
* Will only be used with the "transport" client mode.
* If the client mode is set to "transport" and no hosts are defined, ["localhost", 9300] will be used by default.
*/
client.hosts = [
[host: 'localhost', port: 9300]
]
disableAutoIndex = false
index {
compound_format = true
}
unmarshallComponents = true
datastoreImpl = 'hibernateDatastore'
}
The configuration shouldn't have dramatically changed from older versions, so I don't know if it's that or not, but try to tweak it.
I have some assumptions as to why this would happen; I know for certain that the org.grails.plugins.elasticsearch.index.IndexRequestQueue
is still pretty vulnerable and it could definitely use with smarter operation merging. But then again, it doesn't perform any persistence operations so it might be something to do with transactions.
Given the difficult nature of synchronization issues, I'll need a more concrete and reproducible use-case/test-case/demo-application in order to help you tackle this issue.
(Thanks for the reply)
I just deployed my app with a stable config -- so far the problem seems to be solved. I will update this ticket if I have more findings tomorrow.
Unfortunately we are still getting StaleObjectStateException but with less frequency and appears randomly. I understand it's hard to reproduce but I will see what I can do -- it's will be hard to do without such wonderful plugin.
No need to do without it. You can help me reproduce it, or hunt it down and submit a pull request; I'd be happy to help either way.
This looks suspiciously like https://github.com/mstein/elasticsearch-grails-plugin/issues/15, which was resolved by https://github.com/mstein/elasticsearch-grails-plugin/commit/25722ad2a21d3cde219c51e5777b236381f89555. Doesn't look like that patch made it into the new elasticsearch plugin.
Started to noticed that I am getting a lot of
or
errors and traced it to the installation of the new elasticsearch-gorm 0.0.2.3 plugin. Everything goes back to normal once I removed the plugin.
The general behavior is that saving/updating of data goes well initially but begin to throw StaleObjectStateException after a while. Child objects that were deleted off will appear again even thought the database doesn't contain the records anymore. And then any save/update/delete operations will be met with violent PatchedDefaultFlushEventListener exceptions.
It looks like some kind of caching of gorm objects after indexing that is interfering with gorm.
:-(