[ 
https://issues.apache.org/jira/browse/TS-4626?focusedWorklogId=29915&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-29915
 ]

ASF GitHub Bot logged work on TS-4626:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Sep/16 17:48
            Start Date: 28/Sep/16 17:48
    Worklog Time Spent: 10m 
      Work Description: GitHub user danobi opened a pull request:

    https://github.com/apache/trafficserver/pull/1059

    TS-4626: LogFile::close_file should not delete m_log handle

    LogFile::close_file was incorrectly deleting the m_log object.
    This caused potential race conditions when flushing m_log since
    there aren't any locks protecting m_log accesses.
    
    When the underlying log file on disk is deleted, it is fine to
    not delete m_log. It's fine because the actual flush function
    in Log::flush_thread_main checks to see if m_log is open before
    doing any writes.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/danobi/trafficserver TS-4626

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/trafficserver/pull/1059.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1059
    
----
commit 3ba8a125c51f5e99a01a212d68bc6fed5f12d8ff
Author: Daniel Xu <[email protected]>
Date:   2016-09-28T17:42:54Z

    TS-4626: LogFile::close_file should not delete m_log handle
    
    LogFile::close_file was incorrectly deleting the m_log object.
    This caused potential race conditions when flushing m_log since
    there aren't any locks protecting m_log accesses.
    
    When the underlying log file on disk is deleted, it is fine to
    not delete m_log. It's fine because the actual flush function
    in Log::flush_thread_main checks to see if m_log is open before
    doing any writes.

----


Issue Time Tracking
-------------------

            Worklog Id:     (was: 29915)
            Time Spent: 10m
    Remaining Estimate: 0h

> LogFile::close_file should not delete m_log handle
> --------------------------------------------------
>
>                 Key: TS-4626
>                 URL: https://issues.apache.org/jira/browse/TS-4626
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Core
>            Reporter: Michael Chai
>            Assignee: Daniel Xu
>             Fix For: 7.1.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When log file was deleted on the disk, LogFile::check_fd will close file 
> handle and reopen again.delete m_log at this point will cause 
> LogFile::open_file return "LOG_FILE_COULD_NOT_OPEN_FILE" .  otherwise, will 
> cause trafficserver crash at LogFile::preproc_and_try_delete
> 300         if (!m_log->m_start_time) {
> (gdb) bt
> #0  0x000000000068245f in LogFile::preproc_and_try_delete (this=0x1132eb0, 
> lb=0x7fffdc000da0) at LogFile.cc:300
> #1  0x000000000068caa6 in LogBufferManager::preproc_buffers (this=0x1132970, 
> sink=0x1132eb0) at LogObject.cc:77
> #2  0x0000000000691a53 in LogObject::preproc_buffers (this=0x1132ae0, idx=0) 
> at LogObject.h:146
> #3  0x00000000006901c3 in LogObjectManager::preproc_buffers (this=0x1127228, 
> idx=0) at LogObject.cc:1126
> #4  0x000000000066b668 in Log::preproc_thread_main (args=0x1131edc) at 
> Log.cc:1168
> #5  0x000000000066ce9d in LoggingPreprocContinuation::mainEvent 
> (this=0x1131ea0) at Log.cc:279
> #6  0x000000000050d662 in Continuation::handleEvent (this=0x1131ea0, event=1, 
> data=0x11529a0) at ../iocore/eventsystem/I_Continuation.h:153
> #7  0x00000000007a1e9f in EThread::execute (this=0x7ffff07a1010) at 
> UnixEThread.cc:298
> #8  0x00000000007a0d0c in spawn_thread_internal (a=0x1131ef0) at Thread.cc:84
> #9  0x00007ffff64740a4 in start_thread (arg=0x7ffff07a0700) at 
> pthread_create.c:309
> #10 0x00007ffff541c04d in clone () at 
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
> (gdb) p m_log
> $1 = (BaseLogFile *) 0x0



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to