Date: 201905
Local time of day: 0601-1200
Location: ZZZ.Airport, US
Aircraft: B747-400
Operator: Air Carrier
Operating under: Part 121
Flight plan: IFR
Mission: Cargo / Freight / Delivery
Flight phase: Climb; Cruise
Airspace: Class A ZZZ
ATC / advisory: Center ZZZ
Aircraft component: Navigational Equipment and Processing
Component problem: Malfunctioning
Reporter organization: Air Carrier
Reporter function: Captain
Reporter qualification: Flight Crew Air Transport Pilot (ATP); Flight Crew Instrument; Flight Crew Multiengine
Human factors: Troubleshooting; Situational Awareness
Second reporter function: First Officer
Anomaly: Aircraft Equipment Problem Critical; Deviation - Altitude Excursion From Assigned Altitude; Deviation / Discrepancy - Procedural Published Material / Policy
Detector: Person Flight Crew
When detected: In-flight
Result: Flight Crew Diverted; Flight Crew Landed in Emergency Condition
Contributing factors: Company Policy; Human Factors; Aircraft
Primary problem: Aircraft

Narrative: On climb through 26000 feet the left FMC failed followed immediately by the right. We reselected both FMC's after a minute delay when FMC prompts appeared on both CDU's. Reengaged autopilot and auto throttle. At level off both FMC's failed again and we went through the same procedures. A while busy with that the aircraft started climbing rapidly in VNAV PATH out of 34000 feet. I disconnected all automation and returned to 34000 feet; called for left AP command; ALT HOLD and SPD. I did not reselect VNAV for the remainder of the flight. ATC did not mention the off altitude condition to us. 5 minutes later FMCs again both failed. Reselected them. Never got a chance to run the dual FMC failure checklists before the 'timeout reselect' prompts appeared in the CDU scratch pad at this time.I then turned over the aircraft to the Pilot Monitoring and initiated a conference call to Dispatch; Maintenance Control and the Duty Pilot. I recommended we divert to ZZZ for repairs. They concurred and we got a reroute after reporting the FMC failures and coordination to ATC. Along the way to ZZZ approximately 3.5 hours flight time the FMC's failed no less than 12 times; and we reset after timeout reselect appeared on the CDU's. Each time the LNAV faulted along with the auto-throttle. We went to HDG select and manual thrust until the FMC's reset. We never got off course more than 1 mile en-route. At one point the FMC's took so long to recover we got through the whole Dual FMC failure checklist and then the FMC's recovered. I deemed it prudent to reselect them on as it reduced the workload while they were in working order and we were in RVSM airspace.We did not have more than the one altitude excursion at level off and course excursion less than a mile while in HDG SEL temporarily. We stayed in Alt Hold SPD and LNAV for most of the flight. VNAV seemed to make the problems worse since it strayed off altitude after our level off so we left it off and used FLCH for the remainder of the flight. Upon landing with no corrective action decided on by MX; scheduling gave us less than a 2 hr ground time and then to proceed ZZZ-ZZZ1; which would have put our crew at 20 hours of duty. I then called fatigue followed by the other Captain as well as I did not feel fit or safe to continue. Scheduling set us for 10 hrs rest in ZZZ but on arrival in my room I called scheduling and requested 18 hours rest which was granted. Be advised this exact malfunction was written up on 3 legs in the past 2 weeks prior to our flight. Each corrective action was pulled L and R FMC CBs and reset ops check good. We asked the mechanic prior to departure on our first flight of the day ZZZ2 to ZZZ3 about all the repeats and he said '[Company] told him to reset the breakers on both FMC; run a test and if it passed sign it off; and keep the airplane moving' We had no problems on the first leg with the FMC's it was only on the second leg of the day ZZZ3 ZZZ4 when the problems appeared.Next time I see repeat write ups I will ask to see the maintenance manual for the proper corrective action on the malfunctioning system. I no longer believe just resetting system breakers is the cure all for an ailing system. I should have dumped fuel to maximum landing weight and returned to the departure airport. Even though the FMC's were working most of the time; the root cause of the problems with them could have been shorted wiring which would have led to an electrical fire next. One of the first things Maintenance Control asked if we had reset the FMC Circuit Breakers. In flight; really? I should have demanded a route overland or closely offshore; the reroute we got from Dispatch took us well offshore. I cut some off that off by asking direct to the arrival about halfway through the flight. It wasn't as safe as remaining close to the Continental U.S. Maintenance needs to actually fix the airplanes in this fleet vs.doing the MINIMUM required to get rid of the discrepancies. I'm sure it's not their fault; they are getting orders from HQ 'to keep the airplanes moving'. Lives; customers and the existence of this company is being put under unnecessary risk. The company states that safety is priority one. In my experience; increasingly I'm finding on the line this is not the case; and we're raising the risk of another fatal accident in the near future.


Second narrative: [Report narrative contained no additional information.]


Synopsis: A Flight Crew reported diverting due to malfunctioning FMC's.