[SERVER-31378] mongod crashes when running $dateToString with date of MAX_INT64 Created: 04/Oct/17  Updated: 30/Oct/23  Resolved: 11/Oct/17

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 3.6.0-rc0

Type: Bug Priority: Major - P3
Reporter: Andrew Aldridge Assignee: Charlie Swanson
Resolution: Fixed Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Darwin Andrews-MBP-4.home 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64


Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 2017-10-23
Participants:

 Description   

Given a collection containing the following document:

{"_id":{"$oid":"59d40014dbf8c4234f92dd69"},"date":{"$date": {"$numberLong": "9223372036854775807"}}}

Running the following query on MongoDB 3.6 (4c979fe564f6c6e1081af495eba421d10ae0d086):

db.foo.aggregate([
    {$project: {date: {$dateToString: {date: "$date", format: "%G"}}}}
])

Crashes, yielding the following backtrace:

mongod log

2017-10-03T18:50:46.639-0400 I CONTROL  [initandlisten] MongoDB starting : pid=16112 port=27017 dbpath=var 64-bit host=Andrews-MacBook-Pro-4.local
2017-10-03T18:50:46.640-0400 I CONTROL  [initandlisten] db version v3.5.13-267-g4c979fe564
2017-10-03T18:50:46.640-0400 I CONTROL  [initandlisten] git version: 4c979fe564f6c6e1081af495eba421d10ae0d086
2017-10-03T18:50:46.640-0400 I CONTROL  [initandlisten] allocator: system
2017-10-03T18:50:46.640-0400 I CONTROL  [initandlisten] modules: none
2017-10-03T18:50:46.640-0400 I CONTROL  [initandlisten] build environment:
2017-10-03T18:50:46.640-0400 I CONTROL  [initandlisten]     distarch: x86_64
2017-10-03T18:50:46.640-0400 I CONTROL  [initandlisten]     target_arch: x86_64
2017-10-03T18:50:46.640-0400 I CONTROL  [initandlisten] options: { storage: { dbPath: "var" } }
2017-10-03T18:50:46.642-0400 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=7680M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] 
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] ** NOTE: This is a development version (3.5.13-267-g4c979fe564) of MongoDB.
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] **       Not recommended for production.
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] 
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] 
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server. 
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP 
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] 
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] 
2017-10-03T18:50:46.797-0400 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2017-10-03T18:50:46.864-0400 I STORAGE  [initandlisten] createCollection: local.startup_log with UUID: none
2017-10-03T18:50:46.894-0400 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory 'var/diagnostic.data'
2017-10-03T18:50:46.901-0400 I STORAGE  [initandlisten] createCollection: admin.system.version with UUID: 16037947-797a-4214-8f2a-206a992c46cd
2017-10-03T18:50:46.926-0400 I COMMAND  [initandlisten] setting featureCompatibilityVersion to 3.6
2017-10-03T18:50:46.928-0400 I NETWORK  [initandlisten] waiting for connections on port 27017
2017-10-03T18:50:49.331-0400 I NETWORK  [listener] connection accepted from 127.0.0.1:53204 #1 (1 connection now open)
2017-10-03T18:50:49.333-0400 I NETWORK  [conn1] received client metadata from 127.0.0.1:53204 conn: { driver: { name: "PyMongo", version: "3.5.1" }, os: { type: "Darwin", name: "Darwin", architecture: "x86_64", version: "10.13" }, platform: "CPython 3.6.2.final.0" }
2017-10-03T18:50:50.889-0400 I NETWORK  [conn1] end connection 127.0.0.1:53204 (0 connections now open)
2017-10-03T18:51:00.513-0400 I NETWORK  [listener] connection accepted from 127.0.0.1:53207 #2 (1 connection now open)
2017-10-03T18:51:00.529-0400 I STORAGE  [conn2] createCollection: foo.foo with UUID: 454cee73-0169-4b39-91bb-e76ca6f1edfb
2017-10-03T18:51:00.563-0400 I NETWORK  [conn2] end connection 127.0.0.1:53207 (0 connections now open)
2017-10-03T18:51:07.248-0400 I NETWORK  [listener] connection accepted from 127.0.0.1:53208 #3 (1 connection now open)
2017-10-03T18:51:07.250-0400 I NETWORK  [conn3] received client metadata from 127.0.0.1:53208 conn: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "3.5.13-267-g4c979fe564" }, os: { type: "Darwin", name: "Mac OS X", architecture: "x86_64", version: "17.0.0" } }
2017-10-03T18:51:12.860-0400 F -        [conn3] Invariant failure number <= 9999 src/mongo/db/query/datetime/date_time_support.h 296
2017-10-03T18:51:12.860-0400 F -        [conn3] 
 
***aborting after invariant() failure
 
 
2017-10-03T18:51:12.970-0400 F -        [conn3] Got signal: 6 (Abort trap: 6).
 
 0x10de2f9b4 0x10de2f3d5 0x10de2ed0a 0x7fff64709f5a 0x700003de3f60 0x7fff6453532a 0x10de1be7e 0x10da8d9bf 0x10da8aecb 0x10da8aa6f 0x10d8a1cea 0x10d06907c 0x10d070b1a 0x10d05ac86 0x10d0046b2 0x10cefd653 0x10bffe8a7 0x10bffe663 0x10bfffb4a 0x10b9fea49 0x10b9fde52 0x10b337e8c 0x10b3339e0 0x10b324196 0x10d39d726 0x10d39b37d 0x10b237dbd 0x10b234c92 0x10b231c4b 0x10b22d75a 0x10b22be62 0x10b24b4be 0x10b24a854 0x10b24b0dd 0x10b258128 0x10b258105 0x10b2580dd 0x10b257e19 0x10b10ff4e 0x10d11df93 0x10b24c19a 0x10b24a107 0x10b2496b0 0x10b24a4ed 0x10b24b0dd 0x10b258128 0x10b258105 0x10b2580dd 0x10b257e19 0x10b10ff4e 0x10d12020a 0x10d1200cd 0x10d11fe89 0x10b10ff4e 0x10dbfb3ab 0x7fff647136c1 0x7fff6471356d 0x7fff64712c5d
----- BEGIN BACKTRACE -----
{"backtrace":[{"b":"10AE6C000","o":"2FC39B4","s":"_ZN5mongo15printStackTraceERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEE"},{"b":"10AE6C000","o":"2FC33D5","s":"_ZN5mongo12_GLOBAL__N_123printSignalAndBacktraceEi"},{"b":"10AE6C000","o":"2FC2D0A","s":"_ZN5mongo12_GLOBAL__N_110abruptQuitEi"},{"b":"7FFF64708000","o":"1F5A","s":"_sigtramp"},{"b":"0","o":"700003DE3F60"},{"b":"7FFF644D8000","o":"5D32A","s":"abort"},{"b":"10AE6C000","o":"2FAFE7E","s":"_ZN5mongo15invariantFailedEPKcS1_j"},{"b":"10AE6C000","o":"2C219BF","s":"_ZNK5mongo8TimeZone12insertPaddedINS_17StringBuilderImplINS_21SharedBufferAllocatorEEEEEvRT_ii"},{"b":"10AE6C000","o":"2C1EECB","s":"_ZNK5mongo8TimeZone20outputDateWithFormatINS_17StringBuilderImplINS_21SharedBufferAllocatorEEEEEvRT_NS_10StringDataENS_6Date_tE"},{"b":"10AE6C000","o":"2C1EA6F","s":"_ZNK5mongo8TimeZone10formatDateENS_10StringDataENS_6Date_tE"},{"b":"10AE6C000","o":"2A35CEA","s":"_ZNK5mongo22ExpressionDateToString8evaluateERKNS_8DocumentE"},{"b":"10AE6C000","o":"21FD07C","s":"_ZNK5mongo29parsed_aggregation_projection13InclusionNode17addComputedFieldsEPNS_15MutableDocumentERKNS_8DocumentE"},{"b":"10AE6C000","o":"2204B1A","s":"_ZNK5mongo29parsed_aggregation_projection25ParsedInclusionProjection15applyProjectionERKNS_8DocumentE"},{"b":"10AE6C000","o":"21EEC86","s":"_ZN5mongo29parsed_aggregation_projection27ParsedAggregationProjection19applyTransformationERKNS_8DocumentE"},{"b":"10AE6C000","o":"21986B2","s":"_ZN5mongo42DocumentSourceSingleDocumentTransformation7getNextEv"},{"b":"10AE6C000","o":"2091653","s":"_ZN5mongo8Pipeline7getNextEv"},{"b":"10AE6C000","o":"11928A7","s":"_ZN5mongo18PipelineProxyStage11getNextBsonEv"},{"b":"10AE6C000","o":"1192663","s":"_ZN5mongo18PipelineProxyStage6doWorkEPm"},{"b":"10AE6C000","o":"1193B4A","s":"_ZN5mongo9PlanStage4workEPm"},{"b":"10AE6C000","o":"B92A49","s":"_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE"},{"b":"10AE6C000","o":"B91E52","s":"_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE"},{"b":"10AE6C000","o":"4CBE8C","s":"_ZN5mongo12_GLOBAL__N_119handleCursorCommandEPNS_16OperationContextERKNS_15NamespaceStringEPNS_12ClientCursorERKNS_18AggregationRequestERNS_14BSONObjBuilderE"},{"b":"10AE6C000","o":"4C79E0","s":"_ZN5mongo12runAggregateEPNS_16OperationContextERKNS_15NamespaceStringERKNS_18AggregationRequestERKNS_7BSONObjERNS_14BSONObjBuilderE"},{"b":"10AE6C000","o":"4B8196","s":"_ZN5mongo12_GLOBAL__N_115PipelineCommand3runEPNS_16OperationContextERKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERKNS_7BSONObjERNS_14BSONObjBuilderE"},{"b":"10AE6C000","o":"2531726","s":"_ZN5mongo12BasicCommand11enhancedRunEPNS_16OperationContextERKNS_12OpMsgRequestERNS_14BSONObjBuilderE"},{"b":"10AE6C000","o":"252F37D","s":"_ZN5mongo7Command9publicRunEPNS_16OperationContextERKNS_12OpMsgRequestERNS_14BSONObjBuilderE"},{"b":"10AE6C000","o":"3CBDBD","s":"_ZN5mongo12_GLOBAL__N_114runCommandImplEPNS_16OperationContextEPNS_7CommandERKNS_12OpMsgRequestEPNS_3rpc21ReplyBuilderInterfaceENS_11LogicalTimeE"},{"b":"10AE6C000","o":"3C8C92","s":"_ZN5mongo12_GLOBAL__N_119execCommandDatabaseEPNS_16OperationContextEPNS_7CommandERKNS_12OpMsgRequestEPNS_3rpc21ReplyBuilderInterfaceE"},{"b":"10AE6C000","o":"3C5C4B","s":"_ZZN5mongo12_GLOBAL__N_111runCommandsEPNS_16OperationContextERKNS_7MessageEENK3$_4clEv"},{"b":"10AE6C000","o":"3C175A","s":"_ZN5mongo12_GLOBAL__N_111runCommandsEPNS_16OperationContextERKNS_7MessageE"},{"b":"10AE6C000","o":"3BFE62","s":"_ZN5mongo23ServiceEntryPointMongod13handleRequestEPNS_16OperationContextERKNS_7MessageE"},{"b":"10AE6C000","o":"3DF4BE","s":"_ZN5mongo19ServiceStateMachine15_processMessageERNS0_11ThreadGuardE"},{"b":"10AE6C000","o":"3DE854","s":"_ZN5mongo19ServiceStateMachine15_runNextInGuardERNS0_11ThreadGuardE"},{"b":"10AE6C000","o":"3DF0DD","s":"_ZN5mongo19ServiceStateMachine7runNextEv"},{"b":"10AE6C000","o":"3EC128","s":"_ZZN5mongo19ServiceStateMachine12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsEENK3$_4clEv"},{"b":"10AE6C000","o":"3EC105","s":"_ZZN5mongo19ServiceStateMachine13_scheduleFuncIZNS0_12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S4_ENKUlvE_clEv"},{"b":"10AE6C000","o":"3EC0DD","s":"_ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN5mongo19ServiceStateMachine13_scheduleFuncIZNS4_12scheduleNextENS3_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S8_EUlvE_EEEvDpOT_"},{"b":"10AE6C000","o":"3EBE19","s":"_ZNSt3__110__function6__funcIZN5mongo19ServiceStateMachine13_scheduleFuncIZNS3_12scheduleNextENS2_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S7_EUlvE_NS_9allocatorISB_EEFvvEEclEv"},{"b":"10AE6C000","o":"2A3F4E","s":"_ZNKSt3__18functionIFvvEEclEv"},{"b":"10AE6C000","o":"22B1F93","s":"_ZN5mongo9transport26ServiceExecutorSynchronous8scheduleENSt3__18functionIFvvEEENS0_15ServiceExecutor13ScheduleFlagsE"},{"b":"10AE6C000","o":"3E019A","s":"_ZN5mongo19ServiceStateMachine13_scheduleFuncIZNS0_12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S4_"},{"b":"10AE6C000","o":"3DE107","s":"_ZN5mongo19ServiceStateMachine12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsE"},{"b":"10AE6C000","o":"3DD6B0","s":"_ZN5mongo19ServiceStateMachine15_sourceCallbackENS_6StatusE"},{"b":"10AE6C000","o":"3DE4ED","s":"_ZN5mongo19ServiceStateMachine15_runNextInGuardERNS0_11ThreadGuardE"},{"b":"10AE6C000","o":"3DF0DD","s":"_ZN5mongo19ServiceStateMachine7runNextEv"},{"b":"10AE6C000","o":"3EC128","s":"_ZZN5mongo19ServiceStateMachine12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsEENK3$_4clEv"},{"b":"10AE6C000","o":"3EC105","s":"_ZZN5mongo19ServiceStateMachine13_scheduleFuncIZNS0_12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S4_ENKUlvE_clEv"},{"b":"10AE6C000","o":"3EC0DD","s":"_ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN5mongo19ServiceStateMachine13_scheduleFuncIZNS4_12scheduleNextENS3_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S8_EUlvE_EEEvDpOT_"},{"b":"10AE6C000","o":"3EBE19","s":"_ZNSt3__110__function6__funcIZN5mongo19ServiceStateMachine13_scheduleFuncIZNS3_12scheduleNextENS2_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S7_EUlvE_NS_9allocatorISB_EEFvvEEclEv"},{"b":"10AE6C000","o":"2A3F4E","s":"_ZNKSt3__18functionIFvvEEclEv"},{"b":"10AE6C000","o":"22B420A","s":"_ZZN5mongo9transport26ServiceExecutorSynchronous8scheduleENSt3__18functionIFvvEEENS0_15ServiceExecutor13ScheduleFlagsEENK3$_0clEv"},{"b":"10AE6C000","o":"22B40CD","s":"_ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN5mongo9transport26ServiceExecutorSynchronous8scheduleENS_8functionIFvvEEENS4_15ServiceExecutor13ScheduleFlagsEE3$_0EEEvDpOT_"},{"b":"10AE6C000","o":"22B3E89","s":"_ZNSt3__110__function6__funcIZN5mongo9transport26ServiceExecutorSynchronous8scheduleENS_8functionIFvvEEENS3_15ServiceExecutor13ScheduleFlagsEE3$_0NS_9allocatorISA_EES6_EclEv"},{"b":"10AE6C000","o":"2A3F4E","s":"_ZNKSt3__18functionIFvvEEclEv"},{"b":"10AE6C000","o":"2D8F3AB","s":"_ZN5mongo12_GLOBAL__N_17runFuncEPv"},{"b":"7FFF64710000","o":"36C1","s":"_pthread_body"},{"b":"7FFF64710000","o":"356D","s":"_pthread_body"},{"b":"7FFF64710000","o":"2C5D","s":"thread_start"}],"processInfo":{ "mongodbVersion" : "3.5.13-267-g4c979fe564", "gitVersion" : "4c979fe564f6c6e1081af495eba421d10ae0d086", "compiledModules" : [], "uname" : { "sysname" : "Darwin", "release" : "17.0.0", "version" : "Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64", "machine" : "x86_64" }, "somap" : [ { "path" : "/Users/andrew/Documents/mongo/./mongod", "machType" : 2, "b" : "10AE6C000", "vmaddr" : "100000000", "buildId" : "BB4B0DE54716354488B85CE586FC2013" }, { "path" : "/usr/lib/libSystem.B.dylib", "machType" : 6, "b" : "7FFF62296000", "vmaddr" : "7FFF4CA07000", "buildId" : "BBBE6ABCFD8430A3B69995F1D6EFB334" }, { "path" : "/usr/lib/libc++.1.dylib", "machType" : 6, "b" : "7FFF624C2000", "vmaddr" : "7FFF4CC33000", "buildId" : "FCF5E1F62B0435458004F3AB32FED172" }, { "path" : "/usr/lib/system/libcache.dylib", "machType" : 6, "b" : "7FFF64322000", "vmaddr" : "7FFF4EA93000", "buildId" : "354F3B7D404E33989EBF65CA2CE65211" }, { "path" : "/usr/lib/system/libcommonCrypto.dylib", "machType" : 6, "b" : "7FFF64327000", "vmaddr" : "7FFF4EA98000", "buildId" : "6C502A553B543B48BA7BFA39F56C0B1E" }, { "path" : "/usr/lib/system/libcompiler_rt.dylib", "machType" : 6, "b" : "7FFF64332000", "vmaddr" : "7FFF4EAA3000", "buildId" : "4487CFBAA5D732829E6B94CAD7BE507E" }, { "path" : "/usr/lib/system/libcopyfile.dylib", "machType" : 6, "b" : "7FFF6433A000", "vmaddr" : "7FFF4EAAB000", "buildId" : "7E4BD2645617339BAC73E8D07EF2C51D" }, { "path" : "/usr/lib/system/libcorecrypto.dylib", "machType" : 6, "b" : "7FFF64343000", "vmaddr" : "7FFF4EAB4000", "buildId" : "7974762CDEF7305698569821C27846DB" }, { "path" : "/usr/lib/system/libdispatch.dylib", "machType" : 6, "b" : "7FFF6444E000", "vmaddr" : "7FFF4EBBF000", "buildId" : "0DD784976A2A350A99EF15BF41EA07DD" }, { "path" : "/usr/lib/system/libdyld.dylib", "machType" : 6, "b" : "7FFF64488000", "vmaddr" : "7FFF4EBF9000", "buildId" : "2597D81842D23375BD9D451D5942A6BA" }, { "path" : "/usr/lib/system/libkeymgr.dylib", "machType" : 6, "b" : "7FFF644A6000", "vmaddr" : "7FFF4EC17000", "buildId" : "6D84A96FC65B38ECBDB521FD2C97E7B2" }, { "path" : "/usr/lib/system/liblaunch.dylib", "machType" : 6, "b" : "7FFF644B4000", "vmaddr" : "7FFF4EC25000", "buildId" : "5AD77A68BB4D33AAAA4FDF51D0972FD9" }, { "path" : "/usr/lib/system/libmacho.dylib", "machType" : 6, "b" : "7FFF644B5000", "vmaddr" : "7FFF4EC26000", "buildId" : "756F255307B63B42ACEA2F0F1A5E8D0F" }, { "path" : "/usr/lib/system/libquarantine.dylib", "machType" : 6, "b" : "7FFF644BA000", "vmaddr" : "7FFF4EC2B000", "buildId" : "6AC8773F38173D8299C201BABB9C3CBB" }, { "path" : "/usr/lib/system/libremovefile.dylib", "machType" : 6, "b" : "7FFF644BD000", "vmaddr" : "7FFF4EC2E000", "buildId" : "912FA211DD8C3C92842421B89F8B10FD" }, { "path" : "/usr/lib/system/libsystem_asl.dylib", "machType" : 6, "b" : "7FFF644BF000", "vmaddr" : "7FFF4EC30000", "buildId" : "949729139DF03C78847C43E58919E3DA" }, { "path" : "/usr/lib/system/libsystem_blocks.dylib", "machType" : 6, "b" : "7FFF644D7000", "vmaddr" : "7FFF4EC48000", "buildId" : "F2493BB5B1C63C4D9F1F1B402E0F1DB7" }, { "path" : "/usr/lib/system/libsystem_c.dylib", "machType" : 6, "b" : "7FFF644D8000", "vmaddr" : "7FFF4EC49000", "buildId" : "2D4C21C0993835528DC12C1CFAA10D38" }, { "path" : "/usr/lib/system/libsystem_configuration.dylib", "machType" : 6, "b" : "7FFF64562000", "vmaddr" : "7FFF4ECD3000", "buildId" : "D7EFEAE622A0348EBBBE44FFD41934FA" }, { "path" : "/usr/lib/system/libsystem_coreservices.dylib", "machType" : 6, "b" : "7FFF64566000", "vmaddr" : "7FFF4ECD7000", "buildId" : "21A488D02D07344E8631CC8B2A246F35" }, { "path" : "/usr/lib/system/libsystem_darwin.dylib", "machType" : 6, "b" : "7FFF6456A000", "vmaddr" : "7FFF4ECDB000", "buildId" : "552C05CAD1513F93B570413340BDA9C7" }, { "path" : "/usr/lib/system/libsystem_dnssd.dylib", "machType" : 6, "b" : "7FFF6456C000", "vmaddr" : "7FFF4ECDD000", "buildId" : "6E28973EA25836F6ACFB259ED5885C7A" }, { "path" : "/usr/lib/system/libsystem_info.dylib", "machType" : 6, "b" : "7FFF64573000", "vmaddr" : "7FFF4ECE4000", "buildId" : "483BE95B62EB3663ACB39915A40C70F5" }, { "path" : "/usr/lib/system/libsystem_m.dylib", "machType" : 6, "b" : "7FFF645E3000", "vmaddr" : "7FFF4ED54000", "buildId" : "ABB1B85F9FFE31B8AD4FE39A30794A93" }, { "path" : "/usr/lib/system/libsystem_malloc.dylib", "machType" : 6, "b" : "7FFF6462F000", "vmaddr" : "7FFF4EDA0000", "buildId" : "9F0745FFB92F330D8812BB74001D1D33" }, { "path" : "/usr/lib/system/libsystem_network.dylib", "machType" : 6, "b" : "7FFF6464F000", "vmaddr" : "7FFF4EDC0000", "buildId" : "A51EB0A49AA53F848E25DD8EABE0F97E" }, { "path" : "/usr/lib/system/libsystem_networkextension.dylib", "machType" : 6, "b" : "7FFF646F3000", "vmaddr" : "7FFF4EE64000", "buildId" : "E842569D00BA3DE7AD5A9EF33422CF3E" }, { "path" : "/usr/lib/system/libsystem_notify.dylib", "machType" : 6, "b" : "7FFF646FE000", "vmaddr" : "7FFF4EE6F000", "buildId" : "98EA3D627C8630DE8261D020D2F1EFF3" }, { "path" : "/usr/lib/system/libsystem_sandbox.dylib", "machType" : 6, "b" : "7FFF6471C000", "vmaddr" : "7FFF4EE8D000", "buildId" : "EC90972803653710B00B0BCFCE03DC71" }, { "path" : "/usr/lib/system/libsystem_secinit.dylib", "machType" : 6, "b" : "7FFF64720000", "vmaddr" : "7FFF4EE91000", "buildId" : "F06ADB8F9E9434A7B3C92C22FDD14BAD" }, { "path" : "/usr/lib/system/libsystem_kernel.dylib", "machType" : 6, "b" : "7FFF645BD000", "vmaddr" : "7FFF4ED2E000", "buildId" : "71BA15CB30563CBDA5F5EE61566EEA0C" }, { "path" : "/usr/lib/system/libsystem_platform.dylib", "machType" : 6, "b" : "7FFF64708000", "vmaddr" : "7FFF4EE79000", "buildId" : "9F5A67F7BC65300FBD7407E7732D6372" }, { "path" : "/usr/lib/system/libsystem_pthread.dylib", "machType" : 6, "b" : "7FFF64710000", "vmaddr" : "7FFF4EE81000", "buildId" : "6D0B01102B443D3CB672BD08FE46378A" }, { "path" : "/usr/lib/system/libsystem_symptoms.dylib", "machType" : 6, "b" : "7FFF64722000", "vmaddr" : "7FFF4EE93000", "buildId" : "BF0566B294753B5C86417910F313BA3C" }, { "path" : "/usr/lib/system/libsystem_trace.dylib", "machType" : 6, "b" : "7FFF6472A000", "vmaddr" : "7FFF4EE9B000", "buildId" : "10955EBB1AC830859A2DF3088CA2DF71" }, { "path" : "/usr/lib/system/libunwind.dylib", "machType" : 6, "b" : "7FFF6473F000", "vmaddr" : "7FFF4EEB0000", "buildId" : "6D4FCD49D2A9323395C7A7635CE265F2" }, { "path" : "/usr/lib/system/libxpc.dylib", "machType" : 6, "b" : "7FFF64745000", "vmaddr" : "7FFF4EEB6000", "buildId" : "E7C5DB126D0E3D1EA743F750DF112F5F" }, { "path" : "/usr/lib/closure/libclosured.dylib", "machType" : 6, "b" : "7FFF61D85000", "vmaddr" : "7FFF4C4F6000", "buildId" : "31A6AC038F51367E9E00FF0F1AD10F6F" }, { "path" : "/usr/lib/libobjc.A.dylib", "machType" : 6, "b" : "7FFF63886000", "vmaddr" : "7FFF4DFF7000", "buildId" : "93A92316DE1E378C889199720B50D075" }, { "path" : "/usr/lib/libc++abi.dylib", "machType" : 6, "b" : "7FFF62519000", "vmaddr" : "7FFF4CC8A000", "buildId" : "217656D5BC4037FFB32291CB2AAD4F34" } ] }}
 mongod(_ZN5mongo15printStackTraceERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEE+0x34) [0x10de2f9b4]
 mongod(_ZN5mongo12_GLOBAL__N_123printSignalAndBacktraceEi+0x75) [0x10de2f3d5]
 mongod(_ZN5mongo12_GLOBAL__N_110abruptQuitEi+0x2A) [0x10de2ed0a]
 libsystem_platform.dylib(_sigtramp+0x1A) [0x7fff64709f5a]
 ??? [0x700003de3f60]
 libsystem_c.dylib(abort+0x7F) [0x7fff6453532a]
 mongod(_ZN5mongo15invariantFailedEPKcS1_j+0x17E) [0x10de1be7e]
 mongod(_ZNK5mongo8TimeZone12insertPaddedINS_17StringBuilderImplINS_21SharedBufferAllocatorEEEEEvRT_ii+0xEF) [0x10da8d9bf]
 mongod(_ZNK5mongo8TimeZone20outputDateWithFormatINS_17StringBuilderImplINS_21SharedBufferAllocatorEEEEEvRT_NS_10StringDataENS_6Date_tE+0x3EB) [0x10da8aecb]
 mongod(_ZNK5mongo8TimeZone10formatDateENS_10StringDataENS_6Date_tE+0x7F) [0x10da8aa6f]
 mongod(_ZNK5mongo22ExpressionDateToString8evaluateERKNS_8DocumentE+0x24A) [0x10d8a1cea]
 mongod(_ZNK5mongo29parsed_aggregation_projection13InclusionNode17addComputedFieldsEPNS_15MutableDocumentERKNS_8DocumentE+0x65C) [0x10d06907c]
 mongod(_ZNK5mongo29parsed_aggregation_projection25ParsedInclusionProjection15applyProjectionERKNS_8DocumentE+0xAA) [0x10d070b1a]
 mongod(_ZN5mongo29parsed_aggregation_projection27ParsedAggregationProjection19applyTransformationERKNS_8DocumentE+0x36) [0x10d05ac86]
 mongod(_ZN5mongo42DocumentSourceSingleDocumentTransformation7getNextEv+0x112) [0x10d0046b2]
 mongod(_ZN5mongo8Pipeline7getNextEv+0x113) [0x10cefd653]
 mongod(_ZN5mongo18PipelineProxyStage11getNextBsonEv+0x67) [0x10bffe8a7]
 mongod(_ZN5mongo18PipelineProxyStage6doWorkEPm+0x2B3) [0x10bffe663]
 mongod(_ZN5mongo9PlanStage4workEPm+0xAA) [0x10bfffb4a]
 mongod(_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE+0xB29) [0x10b9fea49]
 mongod(_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE+0x72) [0x10b9fde52]
 mongod(_ZN5mongo12_GLOBAL__N_119handleCursorCommandEPNS_16OperationContextERKNS_15NamespaceStringEPNS_12ClientCursorERKNS_18AggregationRequestERNS_14BSONObjBuilderE+0xFC) [0x10b337e8c]
 mongod(_ZN5mongo12runAggregateEPNS_16OperationContextERKNS_15NamespaceStringERKNS_18AggregationRequestERKNS_7BSONObjERNS_14BSONObjBuilderE+0x4560) [0x10b3339e0]
 mongod(_ZN5mongo12_GLOBAL__N_115PipelineCommand3runEPNS_16OperationContextERKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERKNS_7BSONObjERNS_14BSONObjBuilderE+0x136) [0x10b324196]
 mongod(_ZN5mongo12BasicCommand11enhancedRunEPNS_16OperationContextERKNS_12OpMsgRequestERNS_14BSONObjBuilderE+0x96) [0x10d39d726]
 mongod(_ZN5mongo7Command9publicRunEPNS_16OperationContextERKNS_12OpMsgRequestERNS_14BSONObjBuilderE+0x4D) [0x10d39b37d]
 mongod(_ZN5mongo12_GLOBAL__N_114runCommandImplEPNS_16OperationContextEPNS_7CommandERKNS_12OpMsgRequestEPNS_3rpc21ReplyBuilderInterfaceENS_11LogicalTimeE+0x6ED) [0x10b237dbd]
 mongod(_ZN5mongo12_GLOBAL__N_119execCommandDatabaseEPNS_16OperationContextEPNS_7CommandERKNS_12OpMsgRequestEPNS_3rpc21ReplyBuilderInterfaceE+0x2182) [0x10b234c92]
 mongod(_ZZN5mongo12_GLOBAL__N_111runCommandsEPNS_16OperationContextERKNS_7MessageEENK3$_4clEv+0xC6B) [0x10b231c4b]
 mongod(_ZN5mongo12_GLOBAL__N_111runCommandsEPNS_16OperationContextERKNS_7MessageE+0x7A) [0x10b22d75a]
 mongod(_ZN5mongo23ServiceEntryPointMongod13handleRequestEPNS_16OperationContextERKNS_7MessageE+0x4A2) [0x10b22be62]
 mongod(_ZN5mongo19ServiceStateMachine15_processMessageERNS0_11ThreadGuardE+0x28E) [0x10b24b4be]
 mongod(_ZN5mongo19ServiceStateMachine15_runNextInGuardERNS0_11ThreadGuardE+0x644) [0x10b24a854]
 mongod(_ZN5mongo19ServiceStateMachine7runNextEv+0x9D) [0x10b24b0dd]
 mongod(_ZZN5mongo19ServiceStateMachine12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsEENK3$_4clEv+0x18) [0x10b258128]
 mongod(_ZZN5mongo19ServiceStateMachine13_scheduleFuncIZNS0_12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S4_ENKUlvE_clEv+0x15) [0x10b258105]
 mongod(_ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN5mongo19ServiceStateMachine13_scheduleFuncIZNS4_12scheduleNextENS3_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S8_EUlvE_EEEvDpOT_+0x2D) [0x10b2580dd]
 mongod(_ZNSt3__110__function6__funcIZN5mongo19ServiceStateMachine13_scheduleFuncIZNS3_12scheduleNextENS2_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S7_EUlvE_NS_9allocatorISB_EEFvvEEclEv+0x29) [0x10b257e19]
 mongod(_ZNKSt3__18functionIFvvEEclEv+0x7E) [0x10b10ff4e]
 mongod(_ZN5mongo9transport26ServiceExecutorSynchronous8scheduleENSt3__18functionIFvvEEENS0_15ServiceExecutor13ScheduleFlagsE+0x183) [0x10d11df93]
 mongod(_ZN5mongo19ServiceStateMachine13_scheduleFuncIZNS0_12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S4_+0xCA) [0x10b24c19a]
 mongod(_ZN5mongo19ServiceStateMachine12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsE+0x37) [0x10b24a107]
 mongod(_ZN5mongo19ServiceStateMachine15_sourceCallbackENS_6StatusE+0x220) [0x10b2496b0]
 mongod(_ZN5mongo19ServiceStateMachine15_runNextInGuardERNS0_11ThreadGuardE+0x2DD) [0x10b24a4ed]
 mongod(_ZN5mongo19ServiceStateMachine7runNextEv+0x9D) [0x10b24b0dd]
 mongod(_ZZN5mongo19ServiceStateMachine12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsEENK3$_4clEv+0x18) [0x10b258128]
 mongod(_ZZN5mongo19ServiceStateMachine13_scheduleFuncIZNS0_12scheduleNextENS_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S4_ENKUlvE_clEv+0x15) [0x10b258105]
 mongod(_ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN5mongo19ServiceStateMachine13_scheduleFuncIZNS4_12scheduleNextENS3_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S8_EUlvE_EEEvDpOT_+0x2D) [0x10b2580dd]
 mongod(_ZNSt3__110__function6__funcIZN5mongo19ServiceStateMachine13_scheduleFuncIZNS3_12scheduleNextENS2_9transport15ServiceExecutor13ScheduleFlagsEE3$_4EEvOT_S7_EUlvE_NS_9allocatorISB_EEFvvEEclEv+0x29) [0x10b257e19]
 mongod(_ZNKSt3__18functionIFvvEEclEv+0x7E) [0x10b10ff4e]
 mongod(_ZZN5mongo9transport26ServiceExecutorSynchronous8scheduleENSt3__18functionIFvvEEENS0_15ServiceExecutor13ScheduleFlagsEENK3$_0clEv+0x12A) [0x10d12020a]
 mongod(_ZNSt3__128__invoke_void_return_wrapperIvE6__callIJRZN5mongo9transport26ServiceExecutorSynchronous8scheduleENS_8functionIFvvEEENS4_15ServiceExecutor13ScheduleFlagsEE3$_0EEEvDpOT_+0x2D) [0x10d1200cd]
 mongod(_ZNSt3__110__function6__funcIZN5mongo9transport26ServiceExecutorSynchronous8scheduleENS_8functionIFvvEEENS3_15ServiceExecutor13ScheduleFlagsEE3$_0NS_9allocatorISA_EES6_EclEv+0x29) [0x10d11fe89]
 mongod(_ZNKSt3__18functionIFvvEEclEv+0x7E) [0x10b10ff4e]
 mongod(_ZN5mongo12_GLOBAL__N_17runFuncEPv+0x11B) [0x10dbfb3ab]
 libsystem_pthread.dylib(_pthread_body+0x154) [0x7fff647136c1]
 libsystem_pthread.dylib(_pthread_body+0x0) [0x7fff6471356d]
 libsystem_pthread.dylib(thread_start+0xD) [0x7fff64712c5d]
-----  END BACKTRACE  -----
Abort trap: 6

Analysis

When %G was added to $dateToString, the necessary error checking present for %Y was not added to the new codepath, triggering an invariant in insertPadded().



 Comments   
Comment by Andrew Aldridge [ 11/Oct/17 ]

Thanks!

Comment by Githook User [ 11/Oct/17 ]

Author:

{'email': 'i80and@foxquill.com', 'name': 'Andrew Aldridge', 'username': 'i80and'}

Message: SERVER-31378 Improve error checking of $dateToString

Closes #1181

Signed-off-by: Charlie Swanson <charlie.swanson@mongodb.com>
Branch: master
https://github.com/mongodb/mongo/commit/9489bb5052206c73907949eaa10b0e1eb5d322a4

Comment by Charlie Swanson [ 04/Oct/17 ]

Thanks for the report and the pull request andrew.aldridge! I'll take a look and review - though I apologize in advance I might not get to it immediately.

Generated at Thu Feb 08 04:26:50 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.