Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-2956

favicon produces a stack trace on February the 29th.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 2.0.0, 1.7.0
    • Component/s: HTTP Interface
    • Labels:
      None

      Description

      I was just running my couch instance today and whenever I request the
      favicon (/favicon.ico) I get this in my logs:

      couchdb_1 | [error] [<0.20390.0>] Uncaught error in HTTP request: {error,if_clause}
      couchdb_1 | [info] [<0.20390.0>] Stacktrace:[{calendar,date_to_gregorian_days,3,
      couchdb_1 |[{file,"calendar.erl"},{line,116}]},
      couchdb_1 |                                   {calendar,day_of_the_week,3,
      couchdb_1 |[{file,"calendar.erl"},{line,151}]},
      couchdb_1 |                                   {couch_util,rfc1123_date,1,
      couchdb_1 |[{file,"couch_util.erl"},{line,462}]},
      couchdb_1 |                                   {couch_httpd_misc_handlers,
      couchdb_1 |                                       handle_favicon_req,2,
      couchdb_1 |[{file,"couch_httpd_misc_handlers.erl"},
      couchdb_1 |                                        {line,53}]},
      couchdb_1 |                                   {couch_httpd,handle_request_int,5,
      couchdb_1 |[{file,"couch_httpd.erl"},{line,318}]},
      couchdb_1 |                                   {mochiweb_http,headers,5,
      couchdb_1 |[{file,"mochiweb_http.erl"},{line,94}]},
      couchdb_1 |                                   {proc_lib,init_p_do_apply,3,
      couchdb_1 |[{file,"proc_lib.erl"},{line,239}]}]
      couchdb_1 | [info] [<0.20390.0>] 192.168.99.1 - - GET /favicon.ico 500
      couchdb_1 | [error] [<0.20390.0>] httpd 500 error response:
      couchdb_1 |  {"error":"unknown_error","reason":"if_clause"}
      

      The last part of the couch code is:

      rfc1123_date(UniversalTime) ->
          {{YYYY,MM,DD},{Hour,Min,Sec}} = UniversalTime,
          DayNumber = calendar:day_of_the_week({YYYY,MM,DD}),
      

        Activity

        Hide
        janl Jan Lehnardt added a comment -

        Adam Kocoloski via users@:

        Definitely a bug. We set the favicon.ico to expire “one year from now”, and we do that by incrementing the year by one and keeping all other elements of the date the same

        https://github.com/apache/couchdb/blob/1.6.1/src/couchdb/couch_httpd_misc_handlers.erl#L49

        Show
        janl Jan Lehnardt added a comment - Adam Kocoloski via users@: Definitely a bug. We set the favicon.ico to expire “one year from now”, and we do that by incrementing the year by one and keeping all other elements of the date the same https://github.com/apache/couchdb/blob/1.6.1/src/couchdb/couch_httpd_misc_handlers.erl#L49
        Show
        mj1856@hotmail.com Matt Johnson added a comment - FYI: Zotonic had the same issue. https://github.com/zotonic/zotonic/issues/1202 You can see their fix here: https://github.com/LilDash/zotonic/commit/098cfa47ad956cd5e16490a9adc615928b9caecf
        Hide
        kocolosk Adam Kocoloski added a comment -

        Hah, here's the `z_datetime:next_year/1` function:

        %% @doc Return the date one year later.
        next_year({{Y,2,29},T})  ->
            {{Y+1,3,1}, T};
        next_year({{Y,M,D},T}) ->
            {{Y+1,M,D}, T}.
        

        That's one way to solve it

        Show
        kocolosk Adam Kocoloski added a comment - Hah, here's the `z_datetime:next_year/1` function: %% @doc Return the date one year later. next_year({{Y,2,29},T}) -> {{Y+1,3,1}, T}; next_year({{Y,M,D},T}) -> {{Y+1,M,D}, T}. That's one way to solve it
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user kxepal opened a pull request:

        https://github.com/apache/couchdb-chttpd/pull/104

        Cache favicon for one year

        Backport this feature by following COUCHDB-2956(https://issues.apache.org/jira/browse/COUCHDB-2956)

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

        $ git pull https://github.com/kxepal/couchdb-chttpd cache-favicon

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

        https://github.com/apache/couchdb-chttpd/pull/104.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 #104


        commit 6b1e84f613e2dbd9eb5fe3c8c073f68740587b38
        Author: Alexander Shorin <kxepal@apache.org>
        Date: 2016-03-06T14:15:15Z

        Cache favicon for one year


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user kxepal opened a pull request: https://github.com/apache/couchdb-chttpd/pull/104 Cache favicon for one year Backport this feature by following COUCHDB-2956 ( https://issues.apache.org/jira/browse/COUCHDB-2956 ) You can merge this pull request into a Git repository by running: $ git pull https://github.com/kxepal/couchdb-chttpd cache-favicon Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-chttpd/pull/104.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 #104 commit 6b1e84f613e2dbd9eb5fe3c8c073f68740587b38 Author: Alexander Shorin <kxepal@apache.org> Date: 2016-03-06T14:15:15Z Cache favicon for one year
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user kxepal opened a pull request:

        https://github.com/apache/couchdb/pull/388

        Fix favicon caching on leap year

        COUCHDB-2956

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

        $ git pull https://github.com/kxepal/couchdb 2956-fix-cache-on-leap-year

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

        https://github.com/apache/couchdb/pull/388.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 #388


        commit 9f1001834e2462606f4648bef3d2df2f4af3ca15
        Author: Alexander Shorin <kxepal@apache.org>
        Date: 2016-03-06T14:24:56Z

        Fix favicon caching on leap year

        COUCHDB-2956


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user kxepal opened a pull request: https://github.com/apache/couchdb/pull/388 Fix favicon caching on leap year COUCHDB-2956 You can merge this pull request into a Git repository by running: $ git pull https://github.com/kxepal/couchdb 2956-fix-cache-on-leap-year Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb/pull/388.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 #388 commit 9f1001834e2462606f4648bef3d2df2f4af3ca15 Author: Alexander Shorin <kxepal@apache.org> Date: 2016-03-06T14:24:56Z Fix favicon caching on leap year COUCHDB-2956
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/couchdb-chttpd/pull/104

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/couchdb-chttpd/pull/104
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 051cdc36cb0b7c9104204ea54abd02115b3d848f in couchdb's branch refs/heads/1.x.x from Alexander Shorin
        [ https://git-wip-us.apache.org/repos/asf?p=couchdb.git;h=051cdc3 ]

        Fix favicon caching on leap year

        COUCHDB-2956

        Show
        jira-bot ASF subversion and git services added a comment - Commit 051cdc36cb0b7c9104204ea54abd02115b3d848f in couchdb's branch refs/heads/1.x.x from Alexander Shorin [ https://git-wip-us.apache.org/repos/asf?p=couchdb.git;h=051cdc3 ] Fix favicon caching on leap year COUCHDB-2956
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/couchdb/pull/388

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/couchdb/pull/388

          People

          • Assignee:
            kxepal Alexander Shorin
            Reporter:
            buckett Matthew Buckett
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development