推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
xyjtou
V2EX  ›  Python

遇到一个非常诡异的时间戳故障问题。

  •  
  •   xyjtou · Feb 9, 2017 · 2234 views
    This topic created in 3403 days ago, the information mentioned may be changed or developed.

    环境:阿里云 ubuntu14.04

    过年期间服务器没有任何升级操作过,然后昨天部分用户反应新提交的数据前端一直显示不出来,检查了很久,还担心过年期间被黑客 rm -rf 玩过呢。

    后来检查数据库里的这个数据有保存,但是时间戳居然不对!默认值一直是 datetime.utcnow ,一部分用户登录日志的 datetime.utcnow 记录是准确的 2017-02-08 ,有一部分数据库里存下来的时间戳是 2017-01-29 !大惊! (因为返回给用户的数据有按时间戳过滤,所以 2017-01-29 的数据就显示不出来)

    然后重启一下应用,就又好了,现在就没有机会在去复盘这个错误了。
    这个毛病会是可能出在什么地方呢?

    5 replies    2017-02-10 20:55:26 +08:00
    knightdf
        1
    knightdf  
       Feb 9, 2017
    服务器全部做了时间同步了?
    xyjtou
        2
    xyjtou  
    OP
       Feb 9, 2017
    @knightdf 没有啊,阿里云上 ECS 也要手动同步吗?

    咦,怎么 knightdf 回复的我没有未读提醒(⊙o⊙) @Livid 我账号被降权过了吗?很莫名啊
    AlphaTr
        3
    AlphaTr  
       Feb 9, 2017 via iPhone
    阿里云应该要同步,我阿里云上是 arch, 开始时候没有装 ntpd ,就遇到时间不对的问题……
    knightdf
        4
    knightdf  
       Feb 9, 2017
    @xyjtou 一般的云服务器都需要自己做 ntp update 的,我们的集群都是定时同步的
    xyjtou
        5
    xyjtou  
    OP
       Feb 10, 2017
    @AlphaTr
    @knightdf

    我说呢,谢谢建议!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1073 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 23:29 · PVG 07:29 · LAX 16:29 · JFK 19:29
    ♥ Do have faith in what you're doing.