I am using GWT-RPC to populate Ext-GWT TreeGrids with data from a server. I am using 4 callbacks to populate 6 TreeGrids. As the callback onSuccess function modifies the TreeGrid by inserting rows, the TreeGridView needs to render the rows. The callback class is called MainPnlSummaryTablesAsyncCallback.
For some reason, when it needs to determine the TreeGridView's scroller's offsetHeight via JSNI, onSuccess or onFailure is called on another instance of the callback in the stack trace. A copy of the stack trace I encountered is below.
Isn't this really weird? Why is this happening?
FYI I am using Ext-GWT 2.0.1 and GWT 1.7.0 and I am using hosted mode browser to debug this, although I am pretty sure that this is an issue for web mode.
PnlSummaryClientDebug_as10node6 [Java Application]
com.google.gwt.dev.HostedMode at localhost:3595
Thread [main] (Suspended (breakpoint at line 403 in MainPage$MainPnlSummaryTablesAsyncCallback))
MainPage$8(MainPage$MainPnlSummaryTablesAsyncCallback).onSuccess(GWTPair<AggregateStringGWTTable,AggregateStringGWTTable>) line: 403
MainPage$8(MainPage$MainPnlSummaryTablesAsyncCallback).onSuccess(Object) line: 1
RequestCallbackAdapter<T>.onResponseReceived(Request, Response) line: 215
Request.fireOnResponseReceivedImpl(RequestCallback) line: 264
Request.fireOnResponseReceivedAndCatch(GWT$UncaughtExceptionHandler, RequestCallback) line: 236
Request.fireOnResponseReceived(RequestCallback) line: 227
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] [local variables unavailable]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
MethodAdaptor.invoke(Object, Object...) line: 103
IDispatchImpl.callMethod(CompilingClassLoader, Object, Variant[], MethodAdaptor) line: 126
IDispatchProxy.invoke(int, int, Variant[]) line: 155
IDispatchProxy(IDispatchImpl).Invoke(int, int, int, int, int, int, int, int) line: 294
IDispatchProxy(IDispatchImpl).method6(int[]) line: 194
COMObject.callback6(int[]) line: 117
COM.VtblCall(int, int, int, GUID, int, int, DISPPARAMS, int, EXCEPINFO, int[]) line: not available [native method]
IDispatch.Invoke(int, GUID, int, int, DISPPARAMS, int, EXCEPINFO, int[]) line: 64
OleAutomation.invoke(int, int, Variant[], int[], Variant) line: 493
OleAutomation.invoke(int, Variant[]) line: 417
ModuleSpaceIE6.doInvokeOnWindow(OleAutomation, String, Variant[]) line: 68
ModuleSpaceIE6.doInvoke(String, Object, Class<?>[], Object[]) line: 153
ModuleSpaceIE6(ModuleSpace).invokeNative(String, Object, Class<?>[], Object[]) line: 453
ModuleSpaceIE6(ModuleSpace).invokeNativeInt(String, Object, Class<?>[], Object[]) line: 207
JavaScriptHost.invokeNativeInt(String, Object, Class<?>[], Object[]) line: 75
Element$.getOffsetHeight$(Element) line: not available
El.getHeight(boolean) line: 984
TreeGridView(BufferView).getVisibleRowCount() line: 313
TreeGridView(BufferView).doRender(List<ColumnData>, List<ModelData>, int, int, boolean, boolean) line: 189
TreeGridView(BufferView).doRender(List<ColumnData>, List<ModelData>, int, int, boolean) line: 181
TreeGridView(GridView).renderRows(int, int) line: 1559
TreeGridView(GridView).insertRows(ListStore<ModelData>, int, int, boolean) line: 1242
TreeGridView(GridView).onAdd(ListStore<ModelData>, List<ModelData>, int) line: 1293
GridView$5.storeAdd(StoreEvent<ModelData>) line: 1179
GridView$5(StoreListener<M>).handleEvent(StoreEvent<M>) line: 22
GridView$5(StoreListener<M>).handleEvent(BaseEvent) line: 1
TreeGrid$2(BaseObservable).callListener(Listener<BaseEvent>, BaseEvent) line: 176
TreeGrid$2(BaseObservable).fireEvent(EventType, BaseEvent) line: 96
TreeGrid$2(ListStore<M>).insert(List<? extends M>, int, boolean) line: 467
TreeGrid$2(ListStore<M>).insert(List<? extends M>, int) line: 266
TreeGrid<M>.onAdd(TreeStoreEvent<M>) line: 430
TreeGrid$1.storeAdd(StoreEvent<M>) line: 123
TreeGrid$1(StoreListener<M>).handleEvent(StoreEvent<M>) line: 22
TreeGrid$1(StoreListener<M>).handleEvent(BaseEvent) line: 1
TreeStore<M>(BaseObservable).callListener(Listener<BaseEvent>, BaseEvent) line: 176
TreeStore<M>(BaseObservable).fireEvent(EventType, BaseEvent) line: 96
TreeStore<M>.doInsert(TreeModel, List<TreeModel>, int, boolean, boolean) line: 799
TreeStore<M>.insert(List<M>, int, boolean) line: 493
TreeStore<M>.add(List<M>, boolean) line: 163
TreeStore<M>.add(M, boolean) line: 174
PnlClientFactory.populatePnlDataTreeStore(AggregateStringGWTTable, TreeStore<BaseModel>) line: 42
MainPage$9(MainPage$MainPnlSummaryTablesAsyncCallback).onSuccess(GWTPair<AggregateStringGWTTable,AggregateStringGWTTable>) line: 403
MainPage$9(MainPage$MainPnlSummaryTablesAsyncCallback).onSuccess(Object) line: 1
RequestCallbackAdapter<T>.onResponseReceived(Request, Response) line: 215
Request.fireOnResponseReceivedImpl(RequestCallback) line: 264
Request.fireOnResponseReceivedAndCatch(GWT$UncaughtExceptionHandler, RequestCallback) line: 236
Request.fireOnResponseReceived(RequestCallback) line: 227
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
MethodAdaptor.invoke(Object, Object...) line: 103
IDispatchImpl.callMethod(CompilingClassLoader, Object, Variant[], MethodAdaptor) line: 126
IDispatchProxy.invoke(int, int, Variant[]) line: 155
IDispatchProxy(IDispatchImpl).Invoke(int, int, int, int, int, int, int, int) line: 294
IDispatchProxy(IDispatchImpl).method6(int[]) line: 194
COMObject.callback6(int[]) line: 117
OS.DispatchMessageW(MSG) line: not available [native method]
OS.DispatchMessage(MSG) line: 1925
Display.readAndDispatch() line: 2966
HostedMode(SwtHostedModeBase).processEvents() line: 235
HostedMode(HostedModeBase).pumpEventLoop() line: 558
HostedMode(HostedModeBase).run() line: 405
HostedMode.main(String[]) line: 232
C:\Program Files\Java\jdk1.6.0_06\bin\javaw.exe (Jul 29, 2009 2:11:16 PM)
Ok, it seems that the server was throwing some NullPointerExceptions when the RPC calls were being made... still, I don't understand why the client-side stack trace looked like this (looks kind of misleading, as if two stack traces bled into each other).
Related
I am fitting RandomForestClassifier to the dataset (DecisionTreeClassifier is working fine on that dataset).
"An error occurred while calling {0}{1}{2}".
336 format(target_id, ".", name))
The complete traceback is given below:
/usr/local/lib/python3.8/dist-packages/pyspark/ml/wrapper.py in _fit(self, dataset)
381
382 def _fit(self, dataset: DataFrame) -> JM:
--> 383 java_model = self._fit_java(dataset)
384 model = self._create_model(java_model)
385 return self._copyValues(model)
/usr/local/lib/python3.8/dist-packages/pyspark/ml/wrapper.py in _fit_java(self, dataset)
378
379 self._transfer_params_to_java()
--> 380 return self._java_obj.fit(dataset._jdf)
381
382 def _fit(self, dataset: DataFrame) -> JM:
/usr/local/lib/python3.8/dist-packages/py4j/java_gateway.py in __call__(self, *args)
1319
1320 answer = self.gateway_client.send_command(command)
-> 1321 return_value = get_return_value(
1322 answer, self.gateway_client, self.target_id, self.name)
1323
/usr/local/lib/python3.8/dist-packages/pyspark/sql/utils.py in deco(*a, **kw)
188 def deco(*a: Any, **kw: Any) -> Any:
189 try:
--> 190 return f(*a, **kw)
191 except Py4JJavaError as e:
192 converted = convert_exception(e.java_exception)
/usr/local/lib/python3.8/dist-packages/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
332 format(target_id, ".", name, value))
333 else:
--> 334 raise Py4JError(
335 "An error occurred while calling {0}{1}{2}".
336 format(target_id, ".", name))
Py4JError: An error occurred while calling o85.fit
I am creating a random forest model in pyspark on the expedia dataset and am facing this issue.
The code leading to this error is given here:
va = VectorAssembler(inputCols = x_train.columns, outputCol='features')
va_df = va.transform(x_train)
va_df = va_df.select(['features', 'hotel_cluster'])
rf = RandomForestClassifier(featuresCol="features", labelCol="hotel_cluster", numTrees=10)
dt = rf.fit(va_df) # error here
Any help in identifying the issue will be highly appreciated!
I'm consuming a Weather.com web service which takes a "latitude,longitude" value (e.g. "40.87601089477539,-87.43512725830078") and using Netty to handle the network communication.
The service responds with an error, which is caused by my parameter value's comma being escaped (i.e. "40.87601089477539%2C-87.43512725830078").
# works (when a confidential API key is added)
http://api.weather.com/v2//location?geocode=40.87601089477539,-87.43512725830078
# doesn't work
http://api.weather.com/v2//location?geocode=40.87601089477539%2C-87.43512725830078
The escaping is done in in com.ning.http.client.RequestBuilderBase.toUrl(boolean encode). If I was able to pass false to it then my problem would be solved but it is the Netty library that makes a callout to this method rather than me, and the option is hard-coded.
1) Is there a workaround for Netty consumers? 2) What's the right way to fix this?
EDIT Additional details
Stack trace:
RequestBuilderBase$RequestImpl.toUrl(boolean) line: 166
RequestBuilderBase$RequestImpl.getUrl() line: 118
RequestBuilderBase$RequestImpl.<init>(Request) line: 78
RequestBuilder(RequestBuilderBase<T>).<init>(Class<T>, Request) line: 323
RequestBuilder.<init>(Request) line: 42
NettyAsyncHttpProvider$HttpProtocol.handle(ChannelHandlerContext, MessageEvent) line: 2115
NettyAsyncHttpProvider.messageReceived(ChannelHandlerContext, MessageEvent) line: 1128
NettyAsyncHttpProvider(SimpleChannelUpstreamHandler).handleUpstream(ChannelHandlerContext, ChannelEvent) line: 75
DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline$DefaultChannelHandlerContext, ChannelEvent) line: 564
DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(ChannelEvent) line: 792
ChunkedWriteHandler.handleUpstream(ChannelHandlerContext, ChannelEvent) line: 141
DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline$DefaultChannelHandlerContext, ChannelEvent) line: 564
DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(ChannelEvent) line: 792
HttpContentDecompressor(HttpContentDecoder).messageReceived(ChannelHandlerContext, MessageEvent) line: 100
HttpContentDecompressor(SimpleChannelUpstreamHandler).handleUpstream(ChannelHandlerContext, ChannelEvent) line: 75
DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline$DefaultChannelHandlerContext, ChannelEvent) line: 564
DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(ChannelEvent) line: 792
Channels.fireMessageReceived(ChannelHandlerContext, Object, SocketAddress) line: 296
HttpClientCodec$Decoder(ReplayingDecoder<T>).unfoldAndFireMessageReceived(ChannelHandlerContext, Object, SocketAddress) line: 600
HttpClientCodec$Decoder(ReplayingDecoder<T>).callDecode(ChannelHandlerContext, Channel, ChannelBuffer, ChannelBuffer, SocketAddress) line: 584
HttpClientCodec$Decoder(ReplayingDecoder<T>).messageReceived(ChannelHandlerContext, MessageEvent) line: 445
HttpClientCodec$Decoder(SimpleChannelUpstreamHandler).handleUpstream(ChannelHandlerContext, ChannelEvent) line: 75
HttpClientCodec.handleUpstream(ChannelHandlerContext, ChannelEvent) line: 92
DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline$DefaultChannelHandlerContext, ChannelEvent) line: 564
DefaultChannelPipeline.sendUpstream(ChannelEvent) line: 559
Channels.fireMessageReceived(Channel, Object, SocketAddress) line: 268
Channels.fireMessageReceived(Channel, Object) line: 255
NioWorker.read(SelectionKey) line: 94
NioWorker(AbstractNioWorker).processSelectedKeys(Set<SelectionKey>) line: 372
NioWorker(AbstractNioWorker).run() line: 246
NioWorker.run() line: 38
ThreadRenamingRunnable.run() line: 102
DeadLockProofWorker$1.run() line: 42
ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1142
ThreadPoolExecutor$Worker.run() line: 617 [local variables unavailable]
Thread.run() line: 745 [local variables unavailable]
To answer my own question, none of the public libraries are to blame here. There is a flag you can set to prevent the encoding (setUseRawUrl(true)):
AsyncHttpClient asyncHttpClient = new AsyncHttpClient(
new AsyncHttpClientConfig.Builder()
.setUseRawUrl(true)
.build());
Future<Response> f = asyncHttpClient.prepareGet(url).execute();
Response r = f.get();
I have imported facebooksdk.jar in "Referenced libraries" section of Eclipse project. When an instance of Facebook is created, am running into the below exception. Facebook SDK is 3.15.0.
Any pointers to resolve the below is appreciated.
Thread [<1> main] (Suspended (exception NoClassDefFoundError))
<VM does not provide monitor information>
WebDialog.onCreate(Bundle) line: 208
WebDialog(Dialog).dispatchOnCreate(Bundle) line: 361
WebDialog(Dialog).show() line: 262
AuthorizationClient$WebViewAuthHandler.tryAuthorize(AuthorizationClient$AuthorizationRequest) line: 628
AuthorizationClient.tryCurrentHandler() line: 264
AuthorizationClient.tryNextHandler() line: 230
AuthorizationClient.authorize(AuthorizationClient$AuthorizationRequest) line: 154
AuthorizationClient.startOrContinueAuth(AuthorizationClient$AuthorizationRequest) line: 135
Session.tryLegacyAuth(Session$AuthorizationRequest) line: 1450
Session.authorize(Session$AuthorizationRequest) line: 1165
Session.open(Session$OpenRequest, SessionAuthorizationType) line: 1234
Session.openForPublish(Session$OpenRequest) line: 503
Facebook.openSession(Session, Session$OpenRequest, boolean) line: 319
Facebook.authorize(Activity, String[], int, SessionLoginBehavior, Facebook$DialogListener) line: 313
Facebook.authorize(Activity, String[], Facebook$DialogListener) line: 149
FacebookConnector.login() line: 49
AndroidFacebook.postMessage() line: 116
AndroidFacebook.onCreate(Bundle) line: 57
AndroidFacebook(Activity).performCreate(Bundle) line: 5231
Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1087
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2159
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2245
ActivityThread.access$800(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 135
ActivityThread$H.handleMessage(Message) line: 1196
ActivityThread$H(Handler).dispatchMessage(Message) line: 102
Looper.loop() line: 136
ActivityThread.main(String[]) line: 5017
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 515
ZygoteInit$MethodAndArgsCaller.run() line: 779
ZygoteInit.main(String[]) line: 595
NativeStart.main(String[]) line: not available [native method]
After proceeding to run with the above breakpoint, another exception "InvocationTargetException" is observed with cause being "NoClassDefFoundError".
cause/target in Eclipse Variables window is as below
java.lang.NoClassDefFoundError: com.facebook.android.R$string
The entry in R.txt when facebook SDK jar was generated is not being found.
android.content.res.Resources$NotFoundException: String resource ID #0x7f070011, where the ID resolves to the below
int string com_facebook_loading 0x7f070011
Also have the below jar files included - android-support-v4, bolts.jar, android-support-v7-appcompat,appcompat_v7
How to have an Eclipse RCP application always have a clean workbench at startup?
I just want the ViewParts to be hidden, not unrestored, so the switch to clear workbench data is not what I need.
I try to hide all views on postWindowCreate in the WorkbenchWindowsAdvisor and it works good for all views but one, it is as if I can't hide them all at this stage of the workbench creation.
Code for hiding views (latest attempt):
IWorkbenchWindow[] windows = PlatformUI.getWorkbench()
.getWorkbenchWindows();
for (IWorkbenchWindow workbenchWindow : windows) {
IWorkbenchPage[] pages = workbenchWindow.getPages();
for (IWorkbenchPage iWorkbenchPage : pages) {
IViewReference[] viewReferences = iWorkbenchPage
.getViewReferences();
for (IViewReference iViewReference : viewReferences) {
IWorkbenchPart part = iViewReference.getPart(true);
if (part instanceof ISaveablePart2) {
iWorkbenchPage.hideView((IViewPart) part);
}
}
}
}
Update:
The view in question gets its createPartControl called even though no other of my views have their createPartControl called. It is called after postWindowCreate and postWindowOpen, stack trace:
CreativeAssistantView.createPartControl(Composite) line: 106
CompatibilityView(CompatibilityPart).createPartControl(IWorkbenchPart, Composite) line: 142
CompatibilityView.createPartControl(IWorkbenchPart, Composite) line: 174
CompatibilityView(CompatibilityPart).create() line: 323
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 606
MethodRequestor.execute() line: 56
InjectorImpl.processAnnotated(Class<Annotation>, Object, Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier, ArrayList<Class<?>>) line: 877
InjectorImpl.processAnnotated(Class<Annotation>, Object, Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier, ArrayList<Class<?>>) line: 857
InjectorImpl.inject(Object, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 119
InjectorImpl.internalMake(Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 333
InjectorImpl.make(Class<T>, PrimaryObjectSupplier) line: 254
ContextInjectionFactory.make(Class<T>, IEclipseContext) line: 162
ReflectionContributionFactory.createFromBundle(Bundle, IEclipseContext, IEclipseContext, URI) line: 102
ReflectionContributionFactory.doCreate(String, IEclipseContext, IEclipseContext) line: 71
ReflectionContributionFactory.create(String, IEclipseContext) line: 53
ContributedPartRenderer.createWidget(MUIElement, Object) line: 129
PartRenderingEngine.createWidget(MUIElement, Object) line: 949
PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 633
PartRenderingEngine$6.run() line: 526
SafeRunner.run(ISafeRunnable) line: 42
PartRenderingEngine.createGui(MUIElement, Object, IEclipseContext) line: 511
ElementReferenceRenderer.createWidget(MUIElement, Object) line: 61
PartRenderingEngine.createWidget(MUIElement, Object) line: 949
PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 633
PartRenderingEngine.safeCreateGui(MUIElement) line: 735
PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706
PartRenderingEngine$7.run() line: 700
SafeRunner.run(ISafeRunnable) line: 42
PartRenderingEngine.createGui(MUIElement) line: 685
PartRenderingEngine$1.handleEvent(Event) line: 134
UIEventHandler$1.run() line: 41
UISynchronizer(Synchronizer).syncExec(Runnable) line: 180
UISynchronizer.syncExec(Runnable) line: 150
Display.syncExec(Runnable) line: 4688
E4Application$1.syncExec(Runnable) line: 205
UIEventHandler.handleEvent(Event) line: 38
EventHandlerWrapper.handleEvent(Event, Permission) line: 197
EventHandlerTracker.dispatchEvent(EventHandlerWrapper, Permission, int, Event) line: 197
EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 1
EventManager.dispatchEvent(Set<Entry<K,V>>, EventDispatcher<K,V,E>, int, E) line: 230
ListenerQueue<K,V,E>.dispatchEventSynchronous(int, E) line: 148
EventAdminImpl.dispatchEvent(Event, boolean) line: 135
EventAdminImpl.sendEvent(Event) line: 78
EventComponent.sendEvent(Event) line: 39
EventBroker.send(String, Object) line: 80
UIEventPublisher.notifyChanged(Notification) line: 58
PlaceholderImpl(BasicNotifierImpl).eNotify(Notification) line: 374
PlaceholderImpl(UIElementImpl).setToBeRendered(boolean) line: 290
ModelServiceImpl.showElementInWindow(MWindow, MUIElement) line: 574
ModelServiceImpl.bringToTop(MUIElement) line: 543
PartServiceImpl.switchPerspective(MPerspective) line: 504
PerspectiveStackRenderer.showTab(MUIElement) line: 124
PerspectiveStackRenderer(LazyStackRenderer).postProcess(MUIElement) line: 97
PerspectiveStackRenderer.postProcess(MUIElement) line: 77
PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 649
PartRenderingEngine.safeCreateGui(MUIElement) line: 735
PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706
PartRenderingEngine$7.run() line: 700
SafeRunner.run(ISafeRunnable) line: 42
PartRenderingEngine.createGui(MUIElement) line: 685
SashRenderer(SWTPartRenderer).processContents(MElementContainer<MUIElement>) line: 61
PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 645
PartRenderingEngine.safeCreateGui(MUIElement) line: 735
PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706
PartRenderingEngine$7.run() line: 700
SafeRunner.run(ISafeRunnable) line: 42
PartRenderingEngine.createGui(MUIElement) line: 685
WBWRenderer(SWTPartRenderer).processContents(MElementContainer<MUIElement>) line: 61
WBWRenderer.processContents(MElementContainer<MUIElement>) line: 676
PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 645
PartRenderingEngine.safeCreateGui(MUIElement) line: 735
PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706
PartRenderingEngine$7.run() line: 700
SafeRunner.run(ISafeRunnable) line: 42
PartRenderingEngine.createGui(MUIElement) line: 685
PartRenderingEngine$9.run() line: 1042
Realm.runWithDefault(Realm, Runnable) line: 332
PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 997
E4Workbench.createAndRunUI(MApplicationElement) line: 138
Workbench$5.run() line: 610
Realm.runWithDefault(Realm, Runnable) line: 332
Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 567
PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 150
Application.start(IApplicationContext) line: 32
EclipseAppHandle.run(Object) line: 196
EclipseAppLauncher.runApplication(Object) line: 110
EclipseAppLauncher.start(Object) line: 79
EclipseStarter.run(Object) line: 354
EclipseStarter.run(String[], Runnable) line: 181
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 606
Main.invokeFramework(String[], URL[]) line: 636
Main.basicRun(String[]) line: 591
Main.run(String[]) line: 1450
Main.main(String[]) line: 1426
I'm trying to use the dill module to save my ipython session using dump_session() but I'm getting an error message. I'm using Ipython 1.0.0 and dill 0.2-a-dev 20120503. Does anyone out there have any insight? Thanks in advance.
Niall
Here's the enormous traceback:
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-15-9934c16a537e> in <module>()
----> 1 dill.dump_session("/data/local/nrobin/tset.sess")
/home/h02/nrobin/.local/lib/python2.7/site-packages/dill-0.2a.dev_20120503-py2.7.egg/dill/dill.pyc in dump_session(filename, main_module)
104 pickler._main_module = main_module
105 pickler._session = True # is best indicator of when pickling a session
--> 106 pickler.dump(main_module)
107 pickler._session = False
108 finally:
/usr/local/sci/lib/python2.7/pickle.pyc in dump(self, obj)
222 if self.proto >= 2:
223 self.write(PROTO + chr(self.proto))
--> 224 self.save(obj)
225 self.write(STOP)
226
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/home/h02/nrobin/.local/lib/python2.7/site-packages/dill-0.2a.dev_20120503-py2.7.egg/dill/dill.pyc in save_module(pickler, obj)
415 if _DEBUG[0]: print "M1: %s" % obj
416 pickler.save_reduce(__import__, (obj.__name__,), obj=obj,
--> 417 state=obj.__dict__.copy())
418 else:
419 if _DEBUG[0]: print "M2: %s" % obj
/usr/local/sci/lib/python2.7/pickle.pyc in save_reduce(self, func, args, state, listitems, dictitems, obj)
417
418 if state is not None:
--> 419 save(state)
420 write(BUILD)
421
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/home/h02/nrobin/.local/lib/python2.7/site-packages/dill-0.2a.dev_20120503-py2.7.egg/dill/dill.pyc in save_module_dict(pickler, obj)
284 else:
285 if _DEBUG[0]: print "D2: %s" % "<dict ...>" #obj
--> 286 StockPickler.save_dict(pickler, obj)
287 return
288
/usr/local/sci/lib/python2.7/pickle.pyc in save_dict(self, obj)
647
648 self.memoize(obj)
--> 649 self._batch_setitems(obj.iteritems())
650
651 dispatch[DictionaryType] = save_dict
/usr/local/sci/lib/python2.7/pickle.pyc in _batch_setitems(self, items)
679 for k, v in tmp:
680 save(k)
--> 681 save(v)
682 write(SETITEMS)
683 elif n:
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
329
330 # Save the reduce() output and finally memoize the object
--> 331 self.save_reduce(obj=obj, *rv)
332
333 def persistent_id(self, obj):
/usr/local/sci/lib/python2.7/pickle.pyc in save_reduce(self, func, args, state, listitems, dictitems, obj)
417
418 if state is not None:
--> 419 save(state)
420 write(BUILD)
421
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/home/h02/nrobin/.local/lib/python2.7/site-packages/dill-0.2a.dev_20120503-py2.7.egg/dill/dill.pyc in save_module_dict(pickler, obj)
284 else:
285 if _DEBUG[0]: print "D2: %s" % "<dict ...>" #obj
--> 286 StockPickler.save_dict(pickler, obj)
287 return
288
/usr/local/sci/lib/python2.7/pickle.pyc in save_dict(self, obj)
647
648 self.memoize(obj)
--> 649 self._batch_setitems(obj.iteritems())
650
651 dispatch[DictionaryType] = save_dict
/usr/local/sci/lib/python2.7/pickle.pyc in _batch_setitems(self, items)
684 k, v = tmp[0]
685 save(k)
--> 686 save(v)
687 write(SETITEM)
688 # else tmp is empty, and we're done
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
329
330 # Save the reduce() output and finally memoize the object
--> 331 self.save_reduce(obj=obj, *rv)
332
333 def persistent_id(self, obj):
/usr/local/sci/lib/python2.7/pickle.pyc in save_reduce(self, func, args, state, listitems, dictitems, obj)
417
418 if state is not None:
--> 419 save(state)
420 write(BUILD)
421
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/home/h02/nrobin/.local/lib/python2.7/site-packages/dill-0.2a.dev_20120503-py2.7.egg/dill/dill.pyc in save_module_dict(pickler, obj)
284 else:
285 if _DEBUG[0]: print "D2: %s" % "<dict ...>" #obj
--> 286 StockPickler.save_dict(pickler, obj)
287 return
288
/usr/local/sci/lib/python2.7/pickle.pyc in save_dict(self, obj)
647
648 self.memoize(obj)
--> 649 self._batch_setitems(obj.iteritems())
650
651 dispatch[DictionaryType] = save_dict
/usr/local/sci/lib/python2.7/pickle.pyc in _batch_setitems(self, items)
679 for k, v in tmp:
680 save(k)
--> 681 save(v)
682 write(SETITEMS)
683 elif n:
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/home/h02/nrobin/.local/lib/python2.7/site-packages/dill-0.2a.dev_20120503-py2.7.egg/dill/dill.pyc in save_instancemethod(pickler, obj)
303 if _DEBUG[0]: print "Me: %s" % obj
304 pickler.save_reduce(MethodType, (obj.im_func, obj.im_self,
--> 305 obj.im_class), obj=obj)
306 return
307
/usr/local/sci/lib/python2.7/pickle.pyc in save_reduce(self, func, args, state, listitems, dictitems, obj)
399 else:
400 save(func)
--> 401 save(args)
402 write(REDUCE)
403
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/usr/local/sci/lib/python2.7/pickle.pyc in save_tuple(self, obj)
546 if n <= 3 and proto >= 2:
547 for element in obj:
--> 548 save(element)
549 # Subtle. Same as in the big comment below.
550 if id(obj) in memo:
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/home/h02/nrobin/.local/lib/python2.7/site-packages/dill-0.2a.dev_20120503-py2.7.egg/dill/dill.pyc in save_function(pickler, obj)
268 pickler.save_reduce(FunctionType, (obj.func_code, obj.func_globals,
269 obj.func_name, obj.func_defaults,
--> 270 obj.func_closure), obj=obj)
271 else:
272 if _DEBUG[0]: print "F2: %s" % obj
/usr/local/sci/lib/python2.7/pickle.pyc in save_reduce(self, func, args, state, listitems, dictitems, obj)
399 else:
400 save(func)
--> 401 save(args)
402 write(REDUCE)
403
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/usr/local/sci/lib/python2.7/pickle.pyc in save_tuple(self, obj)
560 write(MARK)
561 for element in obj:
--> 562 save(element)
563
564 if id(obj) in memo:
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/home/h02/nrobin/.local/lib/python2.7/site-packages/dill-0.2a.dev_20120503-py2.7.egg/dill/dill.pyc in save_module_dict(pickler, obj)
284 else:
285 if _DEBUG[0]: print "D2: %s" % "<dict ...>" #obj
--> 286 StockPickler.save_dict(pickler, obj)
287 return
288
/usr/local/sci/lib/python2.7/pickle.pyc in save_dict(self, obj)
647
648 self.memoize(obj)
--> 649 self._batch_setitems(obj.iteritems())
650
651 dispatch[DictionaryType] = save_dict
/usr/local/sci/lib/python2.7/pickle.pyc in _batch_setitems(self, items)
679 for k, v in tmp:
680 save(k)
--> 681 save(v)
682 write(SETITEMS)
683 elif n:
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/home/h02/nrobin/.local/lib/python2.7/site-packages/dill-0.2a.dev_20120503-py2.7.egg/dill/dill.pyc in save_instancemethod(pickler, obj)
303 if _DEBUG[0]: print "Me: %s" % obj
304 pickler.save_reduce(MethodType, (obj.im_func, obj.im_self,
--> 305 obj.im_class), obj=obj)
306 return
307
/usr/local/sci/lib/python2.7/pickle.pyc in save_reduce(self, func, args, state, listitems, dictitems, obj)
399 else:
400 save(func)
--> 401 save(args)
402 write(REDUCE)
403
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/usr/local/sci/lib/python2.7/pickle.pyc in save_tuple(self, obj)
546 if n <= 3 and proto >= 2:
547 for element in obj:
--> 548 save(element)
549 # Subtle. Same as in the big comment below.
550 if id(obj) in memo:
/usr/local/sci/lib/python2.7/pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
/home/h02/nrobin/.local/lib/python2.7/site-packages/dill-0.2a.dev_20120503-py2.7.egg/dill/dill.pyc in save_function(pickler, obj)
268 pickler.save_reduce(FunctionType, (obj.func_code, obj.func_globals,
269 obj.func_name, obj.func_defaults,
--> 270 obj.func_closure), obj=obj)
271 else:
272 if _DEBUG[0]: print "F2: %s" % obj
/usr/local/sci/lib/python2.7/pickle.pyc in save_reduce(self, func, args, state, listitems, dictitems, obj)
403
404 if obj is not None:
--> 405 self.memoize(obj)
406
407 # More new special cases (that work with older protocols as
/usr/local/sci/lib/python2.7/pickle.pyc in memoize(self, obj)
242 if self.fast:
243 return
--> 244 assert id(obj) not in self.memo
245 memo_len = len(self.memo)
246 self.write(self.put(memo_len))
AssertionError:
dill.dump_session didn't work in ipython due to ipython's 'exit' type... basically, ipython hijacks the interpreter's exit method and turns it into some new object type. I have a flag that recognizes when "IPYTHON is True"... however dump_session was still seeing ipython's exit types in the globals, which were being saved in the session dump. Now, I assume they are singletons... and don't save them. Looks like it works as of dill revision #511, and you can serialize the ipython session to a file.
Let me know if you find other issues in ipython, as I rely on ipython users to tell me when there's an issue with dill in ipython.
The updates have been posted to github at https://github.com/uqfoundation,
and the on the issue tracker http://trac.mystic.cacr.caltech.edu/project/pathos/ticket/131.