Com apple hiservices xpcservice

com.apple.hiservices-xpcservice results in frequent hangs and freezes in my mac

Update (2019): The issue still persits even in macOS Mojave, tried everything I could find, nothing seems to solve the issue as of yet!

Problem:

com.apple.hiservices-xpcservice hangs repeatedly ever since I upgraded to macOS Mojave 10.14.1. Now,everytime the process hangs it is indicated by red colored fonts in the Activity Monitor. Due to the frequent hangs my system slows down and it’s barely usable due to extremely slow performance.

What I have done so far:

I have already Googled it (The Process) and also contacted Apple regarding the usage of this process and the reason behind it’s frequent hick-ups. Alas! they couldn’t help much. So, I terminated the process.

Temporary Solution:

As soon as I terminated the process (com.apple.hiservices-xpcservice) my mac started running fast once again.

But, whenever I restart the system or leave the mac idle for a few minutes and then if I start using it once again! out of no where, the process (com.apple.hiservices-xpcservice), shows up once again in the activity monitor resulting in slow performance issues along with hangs and freezes across macOS.

System Info:

Model

iMac (27-inch, Mid 2014)

Processor

3.5GHz quad-core Intel Core i5 processor (Turbo Boost up to 3.9GHz) Configurable to 4.0GHz quad-core Intel Core i7 (Turbo Boost up to 4.4GHz).

Memory

8GB (two 4GB) of 1600MHz DDR3 memory; four SO-DIMM slots, user accessible Configurable to 16GB or 32GB.

Источник

Question: Q: What is com.apple.hiservices-xpcservice ? Is it the cause of slow operation?

Having problems with Menu Bar disappearing, inability to use Force Quit (started with iTunes 12.2.1 but has spread to other apps, SHUTDOWN not working (have to force power-off); Safari and Mail are running very slow. Slow Safari and Mail have been an issue for a while but the problem has worsened in the past few days, post 10.10

On one occasion Force Quit reported «com.apple.hiservices-xpc service not responding» but I was unable to force quit whatever this is not do I know if it’s behind the other problems. Warning has not returned since a forced power-off and restart.

There are others reporting similar problems in the forum but as yet no solution or helpful information beyond «me too». Trying to bump this question up in hopes of a knowledgeable response.

I’m running 10.10.4 on a mid 2010 MacBookPro 24. GHz Intel Core2Duo

Appreciate any insights

Posted on Jul 19, 2015 8:38 AM

Helpful answers

When the machine is behaving abnormally, note the exact time: hour, minute, second.

These instructions must be carried out as an administrator. If you have only one user account, you are the administrator.

Launch the Console application in any of the following ways:

☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)

☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U . The application is in the folder that opens.

☞ Open LaunchPad and start typing the name.

The title of the Console window should be All Messages . If it isn’t, select

SYSTEM LOG QUERIES ▹ All Messages

from the log list on the left. If you don’t see that list, select

View ▹ Show Log List

from the menu bar at the top of the screen.

Each message in the log begins with the date and time when it was entered. Scroll back to the time you noted above.

Select the messages entered from then until the end of the episode, or until they start to repeat, whichever comes first.

Copy the messages to the Clipboard by pressing the key combination command-C . Paste into a reply to this message by pressing command-V .

The log contains a vast amount of information, almost all of it useless for solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.

Please don’t indiscriminately dump thousands of lines from the log into this discussion .

Please don’t post screenshots of log messages—post the text.

Some private information, such as your name, may appear in the log. Anonymize before posting.

When you post the log extract, you might see an error message on the web page: «You have included content in your post that is not permitted,» or «The message contains invalid characters.» That’s a bug in the forum software. Please post the text on Pastebin, then post a link here to the page you created.

Читайте также:  Что будет если удалить gmail с айфона

Источник

Question: Q: com.apple.hiservices-epcservice(Not Responding)

I’m currently running OSX 10.13.6 and having lots of problems with my system locking up for 5+ minutes when I’m accessing MS Word, Evernote or other internet connected apps. Usually if I’m patient the system eventually starts functioning again, but at least once a day I end up force-rebooting it after waiting 5 to 10 minutes (or longer).

In activity monitor shortly before the last lock-up I noticed that com.apple.hiservices-xpcservice was not responding and am wondering if this could be related to the lockups in any way?

Mac mini (Late 2014), macOS High Sierra (10.13.6)

Posted on Sep 12, 2018 1:12 PM

All replies

Loading page content

Page content loaded

Ensure the system has a complete and current backups, as one of the causes of these sorts of pauses is failing hardware. A failing hard disk drive can definitely cause the reported problems. That this is failing hardware far from certain, though.

Then. As a guess. Check that the network is configured correctly per ISP requirements, and particularly that the DNS server settings are configured per the ISP requirements. Or set the DNS server settings to 1.1.1.1 or 8.8.8.8, or to one of the other public DNS servers, and see if things are working better.

if you have add-on anti-virus, anti-malware or other add-on security tools, performance-optimizing or cache cleaning or other tools, remove those per the vendor instructions, reboot and test again. Anti-malware and add-on kernel tools are a common source of weird lock-ups and performance problems.

If that fails, download and run and post the report from Etrecheck, and somebody here can have a look.

Источник

XPC services on macOS app

Before XPC we used to pick up Sockets and Mach Messages (Mach Ports).

XPC for communicating processes

The XPC mechanism offers an alternative to sockets (or Mach Services using MIG) for IPC. We could have, for example, a process that acts as a “server” waiting for clients to access its API and provide some service.

XPC Services on applications

When we talk about XPC Services (capital ‘S’), we are referring to the bundle called XPC Service. Bundles in Apple ecosystem refers to entities represented by a specific directory structure. The most common Bundle you encounter are Application Bundles. If you right-click on any application (For example Chess.app) and select Show content, what you’ll find is a directory structure. Back to XPC, applications can have may XPC Service bundles. You’ll find them inside the Contents/XPCServices/ directory inside the application bundle. Yo can search in your /Applications directory and see how many of the applications rely on XPC Services.

You can also have XPC Services inside Frameworks (Which are another type of Bundle).

Additional Benefits of XPC Services

Using XPC Services in our apps allow us to break some functionality in separate modules (The XPC Service). We could create an XPC Service that can be in charge of running some costly but infrequent tasks. For example, some crypto task to generate random numbers.

Another additional benefit is that the XPC Service runs on its own process. If that process crashes or it’s killed, it doesn’t affect our main application. Imagine that your application support user-defined plugins. And the plugins are built using XPC Services. If they are poorly coded and crash, they won’t affect the integrity of your main application.

An additional benefit to the XPC Service is that they can have their own entitlements. The application will only require the entitlement when it makes use of a service provided by XPC Service that requires the entitlement. Imagine you have an app that uses location but only for specific features. You could move those features to an XPC Service and add the location entitlement only to that XPC Service. If your user never needs the feature that uses the location, it won’t be prompted for permissions, making the use of your app more trustworthy.

XPC and our friend launchd

launchd is the first process to run on our system. It is in charge of launching and managing other processes, services and daemons. launchd is also in charge of scheduling tasks. So it makes sense that launchd will also be responsible for the management of XPC Services.

XPC Service can be stopped if it has been idle for a long time, or be spawned on demand. All the management is done by launchd, and we don’t need to do anything for it to work.

launchd has information about system-wide resource availability and memory pressure, who best to make decisions on how to most effectively use our system’s resources than launchd

Читайте также:  Система корпоративного управления apple

Implement XPC Services

Creating the Service

An XPC service is a bundle in the Contents/XPCServices directory of the main application bundle; the XPC service bundle contains an Info.plist file, an executable, and any resources needed by the service. The XPC service indicates which function to call when the service receives messages by calling xpc_main(3) Mac OS X Developer Tools Manual Page from its main function.

To create an XPC service in Xcode, do the following:

  1. Add a new target to your project, using the XPC Service template.
  2. Add a Copy Files phase to your application’s build settings, which copies the XPC service into the Contents/XPCServices directory of the main application bundle.
  3. Add a dependency to your application’s build settings, to indicate it depends on the XPC service bundle.
  4. If you are writing a low-level (C-based) XPC service, implement a minimal main function to register your event handler, as shown in the following code listing. Replace my_event_handler with the name of your event handler function.

If you are writing a high-level (Objective-C-based) service using NSXPCConnection, first create a connection delegate class that conforms to the NSXPCListenerDelegate protocol. Then, implement a minimal main function that creates and configures a listener object, as shown in the following code listing.

Using the Service

The way you use an XPC service depends on whether you are working with the C API (XPC Services) or the Objective-C API (NSXPCConnection).

Using the Objective-C NSXPCConnection API The Objective-C NSXPCConnection API provides a high-level remote procedure call interface that allows you to call methods on objects in one process from another process (usually an application calling a method in an XPC service). The NSXPCConnection API automatically serializes data structures and objects for transmission and deserializes them on the other end. As a result, calling a method on a remote object behaves much like calling a method on a local object.

To use the NSXPCConnection API, you must create the following:

  • An interface. This mainly consists of a protocol that describes what methods should be callable from the remote process. This is described in Designing an Interface
  • A connection object on both sides. On the service side, this was described previously in Creating the Service. On the client side, this is described in Connecting to and Using an Interface.
  • A listener. This code in the XPC service accepts connections. This is described in Accepting a Connection in the Helper. Messages.

Overall Architecture

When working with NSXPCConnection-based helper apps, both the main application and the helper have an instance of NSXPCConnection. The main application creates its connection object itself, which causes the helper to launch. A delegate method in the helper gets passed its connection object when the connection is established. This is illustrated in Figure 4–1.

Each NSXPCConnection object provides three key features:

  • An exportedInterface property that describes the methods that should be made available to the opposite side of the connection.
  • An exportedObject property that contains a local object to handle method calls coming in from the other side of the connection.
  • The ability to obtain a proxy object for calling methods on the other side of the connection.

When the main application calls a method on a proxy object, the XPC service’s NSXPCConnection object calls that method on the object stored in its exportedObject property.

Similarly, if the XPC service obtains a proxy object and calls a method on that object, the main app’s NSXPCConnection object calls that method on the object stored in its exportedObject property

Designing an Interface

The NSXPCConnection API takes advantage of Objective-C protocols to define the programmatic interface between the calling application and the service. Any instance method that you want to call from the opposite side of a connection must be explicitly defined in a formal protocol. For example:

Because communication over XPC is asynchronous, all methods in the protocol must have a return type of void. If you need to return data, you can define a reply block like this:

A method can have only one reply block. However, because connections are bidirectional, the XPC service helper can also reply by calling methods in the interface provided by the main application, if desired.

Each method must have a return type of void, and all parameters to methods or reply blocks must be either:

  • Arithmetic types (int, char, float, double, uint64_t, NSUInteger, and so on)
  • BOOL
  • C strings
  • C structures and arrays containing only the types listed above
  • Objective-C objects that implement the NSSecureCoding protocol.

Important: If a method (or its reply block) has parameters that are Objective-C collection classes (NSDictionary, NSArray, and so on), and if you need to pass your own custom objects within a collection, you must explicitly tell XPC to allow that class as a member of that collection parameter.

Connecting to and Using an Interface

Once you have defined the protocol, you must create an interface object that describes it. To do this, call the interfaceWithProtocol: method on the NSXPCInterface class. For example:

Читайте также:  Как красиво запаковать айфон

Once you have created the interface object, within the main app, you must configure a connection with it by calling the initWithServiceName: method. For example:

Note: For communicating with XPC services outside your app bundle, you can also configure an XPC connection with the initWithMachServiceName: method.

At this point, the main application can call the remoteObjectProxy or remoteObjectProxyWithErrorHandler: methods on the myConnection object to obtain a proxy object.

This object acts as a proxy for the object that the XPC service has set as its exported object (by setting the exportedObject property). This object must conform to the protocol defined by the remoteObjectInterface property.

When your application calls a method on the proxy object, the corresponding method is called on the exported object inside the XPC service. When the service’s method calls the reply block, the parameter values are serialized and sent back to the application, where the parameter values are deserialized and passed to the reply block. (The reply block executes within the application’s address space.)

Note: If you want to allow the helper process to call methods on an object in your application, you must set the exportedInterface and exportedObject properties before calling resume. These properties are described further in the next section.

Accepting a Connection in the Helper

When an NSXPCConnection-based helper receives the first message from a connection, the listener delegate’s listener:shouldAcceptNewConnection: method is called with a listener object and a connection object. This method lets you decide whether to accept the connection or not; it should return YES to accept the connection or NO to refuse the connection.

Note: The helper receives a connection request when the first actual message is sent. The connection object’s resume method does not cause a message to be sent.

In addition to making policy decisions, this method must configure the connection object. In particular, assuming the helper decides to accept the connection, it must set the following properties on the connection:

  • exportedInterface — an interface object that describes the protocol for the object you want to export. (Creating this object was described previously in Connecting to and Using an Interface.)
  • exportedObject — the local object (usually in the helper) to which the remote client’s method calls should be delivered. Whenever the opposite end of the connection (usually in the application) calls a method on the connection’s proxy object, the corresponding method is called on the object specified by the exportedObject property.

After setting those properties, it should call the connection object’s resume method before returning YES. Although the delegate may defer calling resume, the connection will not receive any messages until it does so.

Sending Messages

Sending messages with NSXPC is as simple as making a method call. For example, given the interface myCookieInterface (described in previous sections) on the XPC connection object myConnection, you can call the feedMeACookie method like this:

When you call that method, the corresponding method in the XPC helper is called automatically. That method, in turn, could use the XPC helper’s connection object similarly to call a method on the object exported by the main application.

Handling Errors

In addition to any error handling methods specific to a given helper’s task, both the XPC service and the main app should also provide the following XPC error handler blocks:

  • Interruption handler — called when the process on the other end of the connection has crashed or has otherwise closed its connection. The local connection object is typically still valid — any future call will automatically spawn a new helper instance unless it is impossible to do so — but you may need to reset any state that the helper would otherwise have kept.

The handler is invoked on the same queue as reply messages and other handlers, and it is always executed after any other messages or reply block handlers (except for the invalidation handler). It is safe to make new requests on the connection from an interruption handler.

  • Invalidation handler — called when the invalidate method is called or when an XPC helper could not be started. When this handler is called, the local connection object is no longer valid and must be recreated. This is always the last handler called on a connection object. When this block is called, the connection object has been torn down. It is not possible to send further messages on the connection at that point, whether inside the handler or elsewhere in your code.

In both cases, you should use block-scoped variables to provide enough contextual information — perhaps a pending operation queue and the connection object itself — so that your handler code can do something sensible, such as retrying pending operations, tearing down the connection, displaying an error dialog, or whatever other actions make sense in your particular app.

Источник

Оцените статью