You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "seregamorph (via GitHub)" <gi...@apache.org> on 2024/04/14 15:15:55 UTC
[PR] BEANUTILS-541 - FluentPropertyBeanIntrospector caches corrupted writeMethod (parallel) [commons-beanutils]
seregamorph opened a new pull request, #234:
URL: https://github.com/apache/commons-beanutils/pull/234
Once https://github.com/apache/commons-beanutils/pull/68 was merged I realized it can work not properly in a concurrent environment 🤦.
I made some tests and it was pretty hard to trigger failure - the merged fix is relatively resistant and a combination of random factors should happen simultaneously, also it only happened with high number of threads (for this reason I believe `1.x` fix can stay as is). But finally I got proof there is a problem still and tried to find a better solution without erasing the cache.
So, how the updated implementation works: now there is no more `PropertyDescriptor.setWriteMethod` and the shared cached `PropertyDescriptor` object is not updated anymore as there is a risk to define a setter method for a field which is wrong in case if getter is defined in super-class and it has several subtypes defining their own setters (with generic types).
Instead, in the `IntrospectionContext` the `PropertyDescriptor` is just replaced with a copy of the shared object with configured setter. This should be valid, because `IntrospectionContext` is not a cached type. If you run `Jira541TestCase.testFluentBeanIntrospectorOnOverriddenSetter` in debugger, you can see that at line `FluentPropertyBeanIntrospector:163` which makes this call
```java
PropertyDescriptor fluentPropertyDescriptor = new PropertyDescriptor(
pd.getName(), pd.getReadMethod(), m);
// replace existing (possibly interited from super-class) to one specific to current class
icontext.addPropertyDescriptor(fluentPropertyDescriptor);
```
the existing object is replaced with the copied by the same name.
Sorry for missing this initially, I just got this insight. But I'd like to notice that initial fix (merged yesterday) makes the situation much better than it was.
I hope you will find time to check this carefully in the debugger and see the specific how the fluent setters logic is working.
Thanks for your attention and trust.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] BEANUTILS-541 - FluentPropertyBeanIntrospector caches corrupted writeMethod (parallel) [commons-beanutils]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #234:
URL: https://github.com/apache/commons-beanutils/pull/234#issuecomment-2054174355
## [Codecov](https://app.codecov.io/gh/apache/commons-beanutils/pull/234?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 65.13%. Comparing base [(`99578cc`)](https://app.codecov.io/gh/apache/commons-beanutils/commit/99578cc306afa6b5ab4ff569111c9cc0d321744b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`2b56a98`)](https://app.codecov.io/gh/apache/commons-beanutils/pull/234?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
> Report is 44 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #234 +/- ##
============================================
+ Coverage 65.06% 65.13% +0.07%
- Complexity 1484 1515 +31
============================================
Files 105 111 +6
Lines 5504 5647 +143
Branches 1068 1086 +18
============================================
+ Hits 3581 3678 +97
- Misses 1464 1490 +26
- Partials 459 479 +20
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/commons-beanutils/pull/234?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] BEANUTILS-541 - FluentPropertyBeanIntrospector caches corrupted writeMethod (parallel) [commons-beanutils]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #234:
URL: https://github.com/apache/commons-beanutils/pull/234#issuecomment-2054176062
@seregamorph
Thank you for circling back and the follow up PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] BEANUTILS-541 - FluentPropertyBeanIntrospector caches corrupted writeMethod (parallel) [commons-beanutils]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory merged PR #234:
URL: https://github.com/apache/commons-beanutils/pull/234
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org