WinCE 6.0 SNTP时间更新网络更改错误

问题描述:

在我将SNTP调试到WinCE 6.0平台之后,我发现了SNTP驱动程序的一个错误。它应该是"TimeRefreshThread()调用RefreshTimeFromServer()锁定问题"。解决问题应该不难,但我认为微软应该为所有版本的WinCE解决它。我不想自己不时地修改这个简单的bug。

After I have debug the SNTP to my WinCE 6.0 platform, I found a bug from SNTP driver. It should be "TimeRefreshThread () calling RefreshTimeFromServer () locking problem". It should be not difficult to solve the problem but I think Microsoft should solve it for all version of WinCE. I don't want to rework that easy bug time to time by myself.

我用最新的WinCE 6.0修复版"Windows Embedded"更新了VS2005 CE 6.0每月更新2013年5月"。

I have update the VS2005 with the latest WinCE 6.0 fix "Windows Embedded CE 6.0 Monthly Update May 2013".

问题是关于"来自OS的"[TIMESVC]网络上/下事件"事件触发两次,两个线程同时尝试更新。因此,第一个更改是正确的,但第二个更改是错误。

The problem is about the "[TIMESVC] Network up/down event from OS" event trigger twice and two thread try to update at the same time. As a result, the first change is correct but the second change is error.

以下是调试输出的问题日志。

Following is the problem log from debug output.

*** ************************************************** ******************************

***********************************************************************************

ARM的Windows CE内核(支持Thumb)建于3月  8 2013年17:05:33



...



[OAL] --OEMInit( )b


...



OEMSetRealTime(2013/5/1 12:0:0.000)



...局域网驱动程序...
$


... WIFI驱动程序...



... RIL司机......



[TIMESVC]装载模块

[TIMESVC]国家重新初始化



...

$
[TIMESVC] NTP_Init

[TIMESVC]从OS启动服务器请求

[TIMESVC]刷新配置

[TIMESVC]重新初始化状态

[TIMESVC]配置:sntp服务器           :stdtime.gov.hk

[TIMESVC]配置:客户                :启用

[TIMESVC]配置:服务器                :已禁用

[TIMESVC]配置:定期刷新       :2147483647 ms(24天)

[TIMESVC]配置:加速刷新   :2147483647 ms(24天)

[TIMESVC]配置:调整阈值  :86400000 ms

[TIMESVC]服务开始

[TIMESVC]客户:在0 ms内安排时间更新

[TIMESVC]服务已成功启动

[TIMESVC]启动服务器请求:0

[TIMESVC]刷新事件

[TIMESVC] NotifyThread开始

[ TIMESVC]时间刷新:无法访问主机stdtime.gov.hk

[TIMESVC]时间刷新:查询所有服务器,但时间未更新。

[TIMESVC]时间刷新失败,重新安排

[TIMESVC]客户:计划时间更新2147483647 ms

[TIMESVC]服务器:时间已更改 - 现在多播?

[ TIMESVC]时间刷新事件处理完成

[TIMESVC]来自OS的网络启动/关闭事件

[TIMESVC]客户端:安排时间更新,以0毫秒为单位
[TIMESVC]时间更新请求:0
$
[TIMESVC]刷新事件



... AutoRas RIL移动电话线拨号.. 。$


[TIMESVC]时间刷新:无法访问主机stdtime.gov.hk

[TIMESVC]时间刷新:查询所有服务器,但时间未更新。

[TIMESVC]时间刷新失败,重新安排时间
[TIMESVC]客户:安排时间更新2147483647 ms

[TIMESVC]服务器:时间已更改 - 现在多播?

[TIMESVC]时间刷新事件处理已完成

[TIMESVC]网络连接来自OS的/ down事件

[TIMESVC]客户:在0 ms内安排时间更新

[TIMESVC]时间更新请求:0

[TIMESVC ]刷新事件

[TIMESVC] NTP_IOControl 0x01040040

[TIMESVC]来自OS的网络上/下事件

[TIMESVC]客户:安排时间更新in 0 ms

[TIMESVC]时间更新请求:0

[TIMESVC]刷新事件

[TIMESVC] NTP_IOControl 0x01040040

[TIMESVC]时间刷新:查询服务器stdtime.gov.hk

[TIMESVC]发送SNTP请求



SNTP数据包:

Leap      :0(无警告)

版本   :4

模式      :3(客户)

Stratum   :0
$
投票      :0

精度:0

根延迟:0x00000000(0秒)

根目录:0x00000000(0秒)

Refid     :00000000(或0.0.0.0)

参考时间:01/01/1900 00:00:00.000

      &nbsp ;                        &NBSP ;      发起时间:01/01/1900
00:00:00.000



收到时间:01/01/1900 00:00:00.000

                                      发送时间:05/01/2013 04:00:53.000
$




[TIMESVC]时间刷新:发送请求,等待回复

[TIMESVC]时间刷新:查询服务器stdtime.gov.hk

[TIMESVC]发送SNTP请求



SNTP包裹:

Leap      :0(无警告)

版本   :4

模式      :3(客户)

Stratum   :0
$
投票      :0

精度:0

根延迟:0x00000000(0秒)

根目录:0x00000000(0秒)

Refid     :00000000(或0.0.0.0)

参考时间:01/01/1900 00:00:00.000

      &nbsp ;                        &NBSP ;      发起时间:01/01/1900
00:00:00.000



收到时间:01/01/1900 00:00:00.000

                                      发送时间:05/01/2013 04:00:54.000
$




[TIMESVC]时间刷新:发送请求,等待回复

[TIMESVC]收到SNTP回复



SNTP包:

Leap      :0(无警告)

版本   :4

模式      :4(服务器)

Stratum   :1

投票      :3

精度:3

根延迟:0x00000000(0秒)

根目录:0x00000007(1秒)

Refid     :4d525300(或0.83.82.77)

参考时间:07/18/2013 03:08:55.036
$
      &nbsp ;                        &NBSP ;      发起时间:05/01/2013
04:00:53.000



收到时间:07/18/2013 03:08:55.467

                                      发送时间:07/18/2013 03:08:55.467

$


OEMSetRealTime(2013/7/18 11:8:55.000)

[TIMESVC]时间刷新:接受时间。偏移= 6736081 s。

[TIMESVC]时间刷新:旧时间:05/01/2013 04:00:54.000

[TIMESVC]时间刷新:新时间:07 / 18/2013 03:08:55.967

[TIMESVC]客户:计划时间更新2147483647 ms

[TIMESVC]成功刷新时间

[TIMESVC]服务器:时间已更改 - 现在多播?

[TIMESVC]时间刷新事件处理已完成

[TIMESVC]收到SNTP响应



SNTP包:

Leap      :0(无警告)

版本   :4

模式      :4(服务器)

Stratum   :1

投票      :3

精度:3

根延迟:0x00000000(0秒)

Root disp:0x00000008(2秒)

Refid     :4d525300(或0.83.82.77)

参考时间:07/18/2013 03:08:55.036
$
      &nbsp ;                        &NBSP ;      发起时间:05/01/2013
04:00:54.000



收到时间:07/18/2013 03:08:55.650

                                      发送时间:07/18/2013 03:08:55.650




OEMSetRealTime(2013/8/26 10:42:56.000)

[TIMESVC]时间刷新:接受时间。偏移= 3368040 s。

[TIMESVC]时间刷新:旧时间:07/18/2013 03:08:56.000

[TIMESVC]时间刷新:新时间:08 / 26/2013 02:42:56.650

[TIMESVC]客户:计划时间更新2147483647 ms

[TIMESVC]成功刷新时间

[TIMESVC]服务器:时间已更改 - 现在多播?

[TIMESVC]时间刷新事件处理已完成

Windows CE Kernel for ARM (Thumb Enabled) Built on Mar  8 2013 at 17:05:33

...

[OAL] --OEMInit()

...

OEMSetRealTime(2013/5/1 12:0:0.000)

... LAN driver ...

... WIFI driver ...

... RIL driver ...

[TIMESVC] Module loaded
[TIMESVC] State reinitialized

...

[TIMESVC] NTP_Init
[TIMESVC] Start Server request from OS
[TIMESVC] Refreshing configuration
[TIMESVC] State reinitialized
[TIMESVC] Configuration: sntp server           : stdtime.gov.hk
[TIMESVC] Configuration: client                : enabled
[TIMESVC] Configuration: server                : disabled
[TIMESVC] Configuration: regular refresh       : 2147483647 ms (24 day(s))
[TIMESVC] Configuration: accelerated refresh   : 2147483647 ms (24 day(s))
[TIMESVC] Configuration: adjustment threshold  : 86400000 ms
[TIMESVC] Service starting
[TIMESVC] Client: schedule time update in 0 ms
[TIMESVC] Service started successfully
[TIMESVC] Start Server request : 0
[TIMESVC] Refresh Event
[TIMESVC] NotifyThread started
[TIMESVC] Time Refresh: host stdtime.gov.hk is not reachable
[TIMESVC] Time Refresh: all servers queried, but time not updated.
[TIMESVC] Time Refresh failed, rescheduling
[TIMESVC] Client: schedule time update in 2147483647 ms
[TIMESVC] Server: Time changed - multicast now?
[TIMESVC] Time Refresh event processing completed
[TIMESVC] Network up/down event from OS
[TIMESVC] Client: schedule time update in 0 ms
[TIMESVC] Time update request : 0
[TIMESVC] Refresh Event

... AutoRas RIL Cellular Line Dial Up ...

[TIMESVC] Time Refresh: host stdtime.gov.hk is not reachable
[TIMESVC] Time Refresh: all servers queried, but time not updated.
[TIMESVC] Time Refresh failed, rescheduling
[TIMESVC] Client: schedule time update in 2147483647 ms
[TIMESVC] Server: Time changed - multicast now?
[TIMESVC] Time Refresh event processing completed
[TIMESVC] Network up/down event from OS
[TIMESVC] Client: schedule time update in 0 ms
[TIMESVC] Time update request : 0
[TIMESVC] Refresh Event
[TIMESVC] NTP_IOControl 0x01040040
[TIMESVC] Network up/down event from OS
[TIMESVC] Client: schedule time update in 0 ms
[TIMESVC] Time update request : 0
[TIMESVC] Refresh Event
[TIMESVC] NTP_IOControl 0x01040040
[TIMESVC] Time Refresh: querying server stdtime.gov.hk
[TIMESVC] Sending SNTP request

SNTP Packet:
Leap      : 0 (No warning)
Version   : 4
Mode      : 3 (client)
Stratum   : 0
Poll      : 0
Precision : 0
Root delay: 0x00000000 (0 sec)
Root disp : 0x00000000 (0 sec)
Refid     : 00000000 (or 0.0.0.0)
Reference time: 01/01/1900 00:00:00.000
                                       Origination time: 01/01/1900 00:00:00.000

Received time: 01/01/1900 00:00:00.000
                                      Transmitted time: 05/01/2013 04:00:53.000


[TIMESVC] Time Refresh: sent request, awaiting response
[TIMESVC] Time Refresh: querying server stdtime.gov.hk
[TIMESVC] Sending SNTP request

SNTP Packet:
Leap      : 0 (No warning)
Version   : 4
Mode      : 3 (client)
Stratum   : 0
Poll      : 0
Precision : 0
Root delay: 0x00000000 (0 sec)
Root disp : 0x00000000 (0 sec)
Refid     : 00000000 (or 0.0.0.0)
Reference time: 01/01/1900 00:00:00.000
                                       Origination time: 01/01/1900 00:00:00.000

Received time: 01/01/1900 00:00:00.000
                                      Transmitted time: 05/01/2013 04:00:54.000


[TIMESVC] Time Refresh: sent request, awaiting response
[TIMESVC] Received SNTP response

SNTP Packet:
Leap      : 0 (No warning)
Version   : 4
Mode      : 4 (server)
Stratum   : 1
Poll      : 3
Precision : 3
Root delay: 0x00000000 (0 sec)
Root disp : 0x00000007 (1 sec)
Refid     : 4d525300 (or 0.83.82.77)
Reference time: 07/18/2013 03:08:55.036
                                       Origination time: 05/01/2013 04:00:53.000

Received time: 07/18/2013 03:08:55.467
                                      Transmitted time: 07/18/2013 03:08:55.467


OEMSetRealTime(2013/7/18 11:8:55.000)
[TIMESVC] Time Refresh: time accepted. offset = 6736081 s.
[TIMESVC] Time Refresh: old time: 05/01/2013 04:00:54.000
[TIMESVC] Time Refresh: new time: 07/18/2013 03:08:55.967
[TIMESVC] Client: schedule time update in 2147483647 ms
[TIMESVC] Time successfully refreshed
[TIMESVC] Server: Time changed - multicast now?
[TIMESVC] Time Refresh event processing completed
[TIMESVC] Received SNTP response

SNTP Packet:
Leap      : 0 (No warning)
Version   : 4
Mode      : 4 (server)
Stratum   : 1
Poll      : 3
Precision : 3
Root delay: 0x00000000 (0 sec)
Root disp : 0x00000008 (2 sec)
Refid     : 4d525300 (or 0.83.82.77)
Reference time: 07/18/2013 03:08:55.036
                                       Origination time: 05/01/2013 04:00:54.000

Received time: 07/18/2013 03:08:55.650
                                      Transmitted time: 07/18/2013 03:08:55.650


OEMSetRealTime(2013/8/26 10:42:56.000)
[TIMESVC] Time Refresh: time accepted. offset = 3368040 s.
[TIMESVC] Time Refresh: old time: 07/18/2013 03:08:56.000
[TIMESVC] Time Refresh: new time: 08/26/2013 02:42:56.650
[TIMESVC] Client: schedule time update in 2147483647 ms
[TIMESVC] Time successfully refreshed
[TIMESVC] Server: Time changed - multicast now?
[TIMESVC] Time Refresh event processing completed

**** ************************************************** *****************************

***********************************************************************************

我同意MS应该修复任何严重的错误。然而,这并不是实现这一目标的方法。跟随该线程的MS团队成员数量很少。您需要致电MS寻求支持(您应该使用Platform Builder获得一些技术支持事件),
报告该错误,如您所述,并请求新的QFE来修复它。

I agree that MS should fix any serious bugs. This, however, is not a method to make that happen. The number of MS team members following the thread is small. You need to call MS for support (you should get some technical support incidents with Platform Builder), report the bug, as you've done, and request a new QFE to fix it.

我认为,考虑到Windows CE 6的年龄,实际获得旧版本的遗留问题的QFE的可能性很小。如果是我,我会自己为我的客户解决这个问题,并希望MS最终能做些什么。

I think that, given the age of Windows CE 6, the chances of actually getting a QFE for a legacy issue that old are small. If it were me, I'd fix it myself for my customers and hope that MS eventually does something.

Paul T。