Title: batch/chunk-exception sample has too strong a dependency on WildFly behavior (incl. bug?) on retry after rollback · Issue #281 · javaee-samples/javaee7-samples · GitHub
Open Graph Title: batch/chunk-exception sample has too strong a dependency on WildFly behavior (incl. bug?) on retry after rollback · Issue #281 · javaee-samples/javaee7-samples
X Title: batch/chunk-exception sample has too strong a dependency on WildFly behavior (incl. bug?) on retry after rollback · Issue #281 · javaee-samples/javaee7-samples
Description: Summary There are some differences between GlassFish and WildFly in the retry behavior after a rollback. This affects the metric counts (as the test observes in a commented-out assertion on the skipped write count). I think, though, that...
Open Graph Description: Summary There are some differences between GlassFish and WildFly in the retry behavior after a rollback. This affects the metric counts (as the test observes in a commented-out assertion on the ski...
X Description: Summary There are some differences between GlassFish and WildFly in the retry behavior after a rollback. This affects the metric counts (as the test observes in a commented-out assertion on the ski...
Opengraph URL: https://github.com/javaee-samples/javaee7-samples/issues/281
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"batch/chunk-exception sample has too strong a dependency on WildFly behavior (incl. bug?) on retry after rollback ","articleBody":"# Summary\n\nThere are some differences between GlassFish and WildFly in the retry behavior after a rollback. This affects the metric counts (as the test observes in a commented-out assertion on the skipped write count). I think, though, that there might be a bug in the WildFly implementation. Here is a writeup of my findings and some suggestions.\n# Some background\n\nCurrently, GlassFish 4.1. includes the 1.0 version of \"jbatch\" (the Batch RI). Unfortunately, in this version, we failed to correctly implement the retry behavior described in the 1.0 spec:\n\n_8.2.1.4.4 Default Retry Behavior - Rollback\nWhen a retryable exception occurs, the default behavior... rollback the current chunk and re-process it with an item-count of 1..._\n\nWe addressed this in the pending release of jbatch version 1.0.1, which I've just been testing these samples against (This will be at some point integrated into GlassFish though I couldn't say exactly when or what version.) The code is here: https://github.com/WASdev/standards.jsr352.jbatch.\n\nFrom here on when I refer to GF, I mean GF assuming the inclusion of the pending jbatch 1.0.1 update.\n# Test Flow\n\nLet me start contrasting the chunk-by-chunk sequence across GF and WF, and then look at the test assertions.\n## GF (post-1.0.1)\n### Each line represents a chunk, with any special explanation supplied\n\n1,2,3\n4,5 (rollback, retry after reader exception)\n4 (1-at-a-time processing on retry after rollback)\n5\n6,7,8 (skip 6, 8 causes retry after writer exception)\n6 (1-at-a-time processing, skip, write nothing)\n7 \n8 (skip after writer exception because now that we're already in retry, skip causes precedence)\n9,10 (end of data)\n## WildFly\n### (Based on the SysOut, not detailed debugging).\n\n1,2,3 \n4,5 (retry after reader exception)\n4\n5, 6, 7 -> (skip 6, write 5,7) # First difference from GF\n8, 9, 10 -> (retry after writer exception)\n8 (skip after writer exc)\n9 (write 8,9 and skip)\n10 (write 8,9,10 and retry, perhaps because skip limit is reached)\n8 (# retries on exc throw has surpassed, so stop throwing exceptions)\n9\n10\n\nSo the behavior diverges during the first retry. In GF, after the reader throws a retryable exc on item 5, \nwe process items 4 and 5, each in single-item chunk. In WF, after item 4 is processed in a single-item chunk, items 5-7 are attempted to be handled in a normal-sized chunk (given item-count=3). \n\nIn GF, then, we revert to normal chunk size starting with item 6. We skip item 6 in the processor, and then the presence of item 8 causes the writer to throws a (retryable) exception. We then handle 6-8 one at a time, skipping 6 again (in process), and this time skipping item 8 (since on retry, the skippable takes precedence over the retryable configuration for this exception).\n\nIn WF, the next chunk consists of items 8-10, which forces a retryable exception from the writer. On retry with a single-item chunk of item 8, the writer again throws an exception, and this time skip takes precedence.\n## Bug in WF? (or am I missing something)\n\nNext things start looking strange to me.\n\nThe reader next reads item 9, however the SysOut shows that the writer is passed both items 8 and 9, instead of just the single item 9. The presence of item 8 triggers the exception thrown by the writer logic. It seems then we continue on enough times so the `if (retries \u003c= 3)` check fails and we stop throwing exceptions.\n\nStepping through the WF behavior in even more details raises a couple more questions, but if this is just a bug then maybe these aren't worth going into.\n## Suggestions\n\nNow, I'm not clear on exactly which behaviors this sample was intended to showcase and test. \n\nPinning down the exact metrics across WF and GF is going to be tricky since every detail of the retry after rollback processing is not completey specified, as well as the fact that the behavior of the metrics across rollback is not completely specified. E.g. in the above example, in GF we count 2 processor skips for item 6, vs. 1 for WF, and in GF we count 1 writer skip for item 8 vs. 2 for WF.\n\nIf there is indeed a WF bug here, then it's possible both WF and GF would use only 1 writer skip. However the difference in processor skips may remain.\n\nI'd suggest for a sample/test like this adding a check of which records are ultimately written by the writer, since this is truly the real end result of this job.\n\nIn GF, we'll ultimately write items:\n (1,2,3,4,5,7,9,10)\n\nIn WF, we'll end up writing items:\n (1,2,3,4,5,7,8,9,10)\n(again, I'm guessing item 8 gets written as a bug)\n\nThis difference is more concerning than the metric count difference. I don't want to say the spec has conclusively eliminated any possibility of this happening across implementations, but I wonder if there is a WF and if it is fixed if this difference would go away.\n## Code\n\nIn af7495158c259c8e6d00f7c161caf4ff4291d563, I conveniently changed the test to work for GF. It will fail with WF, currently, though, but I imagine it could work for WF if there is a bug that is fixed.\n","author":{"url":"https://github.com/scottkurz","@type":"Person","name":"scottkurz"},"datePublished":"2014-12-14T18:31:47Z","url":"https://github.com/javaee-samples/javaee7-samples/issues/281"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:58107cf6-3531-86c8-57e4-e01cf1512d45 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E7A2:A71F9:2C64CC6:383818B:6B01E905 |
| html-safe-nonce | 5e3ae36e750a7e03d98660d1b75b93ea9b8ab9d47e9a6493265f02960a13be53 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFN0EyOkE3MUY5OjJDNjRDQzY6MzgzODE4Qjo2QjAxRTkwNSIsInZpc2l0b3JfaWQiOiI4NzA2MzI2NDc2NjQ1MDY3MDEzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4dd3b82ed078c88cc1a82c359fc45b9603b37b43f95587c1c6745fee4d3525ad |
| hovercard-subject-tag | issue:51927095 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/javaee-samples/javaee7-samples/281/issue_layout |
| twitter:image | https://opengraph.githubassets.com/06c77308ec25c7b553990e58577017f3a768b4e1035ac780f56e6c2db16e93fe/javaee-samples/javaee7-samples/issues/281 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/06c77308ec25c7b553990e58577017f3a768b4e1035ac780f56e6c2db16e93fe/javaee-samples/javaee7-samples/issues/281 |
| og:image:alt | Summary There are some differences between GlassFish and WildFly in the retry behavior after a rollback. This affects the metric counts (as the test observes in a commented-out assertion on the ski... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | scottkurz |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/javaee-samples/javaee7-samples git https://github.com/javaee-samples/javaee7-samples.git |
| octolytics-dimension-user_id | 6052086 |
| octolytics-dimension-user_login | javaee-samples |
| octolytics-dimension-repository_id | 12414592 |
| octolytics-dimension-repository_nwo | javaee-samples/javaee7-samples |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 12414592 |
| octolytics-dimension-repository_network_root_nwo | javaee-samples/javaee7-samples |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width