Skip to content

fix crash in CacheVC::openReadFromWriter - #5122

Merged
scw00 merged 1 commit into
apache:masterfrom
rienzi2012:fix_frags_table_crash
Mar 7, 2019
Merged

scw00 merged 1 commit into
apache:masterfrom
rienzi2012:fix_frags_table_crash

Conversation

@rienzi2012

@rienzi2012 rienzi2012 commented Mar 6, 2019 •

Copy link
Copy Markdown

set m_alt->m_frag_offsets to nullptr causes crash when requests copy data from this pointer in CacheVC::openReadFromWriter

@scw00
scw00 self-requested a review March 6, 2019 05:07
@scw00 scw00 added the Cache label Mar 6, 2019
@scw00 scw00 added this to the 9.0.0 milestone Mar 6, 2019
@scw00

scw00 commented Mar 6, 2019

Copy link
Copy Markdown
Member

[approve ci]

@scw00 scw00 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@scw00
scw00 requested a review from SolidWallOfCode March 6, 2019 05:10
@scw00

scw00 commented Mar 6, 2019 •

Copy link
Copy Markdown
Member

Here is test method

diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index 178ec08..c5017d4 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -1087,7 +1087,8 @@ Lwait:
     if (event == EVENT_CALL && c->mutex->thread_holding == mutex->thread_holding) {
       ret = EVENT_RETURN;
     } else if (c->initial_thread != nullptr) {
-      c->initial_thread->schedule_imm_signal(c, AIO_EVENT_DONE);
+      auto event = c->initial_thread->schedule_imm_signal(c, AIO_EVENT_DONE);
+      event->cookie = (void *)0x123456;
     } else {
       eventProcessor.schedule_imm_signal(c, ET_CALL, AIO_EVENT_DONE);
     }
diff --git a/iocore/eventsystem/UnixEThread.cc b/iocore/eventsystem/UnixEThread.cc
index e8586fa..6bbc175 100644
--- a/iocore/eventsystem/UnixEThread.cc
+++ b/iocore/eventsystem/UnixEThread.cc
@@ -118,6 +118,9 @@ void
 EThread::process_event(Event *e, int calling_code)
 {
   ink_assert((!e->in_the_prot_queue && !e->in_the_priority_queue));
+  if (e->cookie == (void *)0x123456) {
+      sleep(10);
+  }
   MUTEX_TRY_LOCK(lock, e->mutex, this);
   if (!lock.is_locked()) {
     e->timeout_at = cur_time + DELAY_FOR_RETRY;

Send two requests to get 1m file.

@scw00
scw00 merged commit d91ca9e into apache:master Mar 7, 2019
@bryancall

Copy link
Copy Markdown
Contributor

This was broken in: Avoid ats_malloc in unmarshal #4874

@bryancall bryancall modified the milestones: 9.0.0, 8.1.0 Mar 19, 2020
@bryancall

Copy link
Copy Markdown
Contributor

Cherry picked into 8.1.x for the 8.1.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants