Skip to content

Pub hangs creating lock file #6986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
munificent opened this issue Nov 28, 2012 · 19 comments
Closed

Pub hangs creating lock file #6986

munificent opened this issue Nov 28, 2012 · 19 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io
Milestone

Comments

@munificent
Copy link
Member

From deadpikasso:

When launching pub install either from command line or from DartEditor, the command hangs indefinitely. I'm on Windows 7 Home x64, Dart version 0.2.4.2_r15130.

pub --trace install outputs nothing

I've done some little debug into the util/pub and it actually hangs on the creation of the lock file, couldn't go further tho.

Creating the file manually solved the issue, and everything worked as expected, but I can't get it working without creating the file beforehand.

@munificent
Copy link
Member Author

Can you give me a few more details here?

When you create the file manually, are you creating an empty file? What are the contents?

Can you try running pub update without a lock file and let me know what that does?

Thanks!


Added NeedsInfo label.

@DartBot
Copy link

DartBot commented Nov 28, 2012

This comment was originally written by [email protected]


The file was initially empty (steps taken: create empty text file, rename+change extension), I've just named it pubspec.lock and when running pub install again it just filled itself up with the following json encoded content.

{"packages":{"web_components":{"version":"0.2.6+1","source":"hosted","description":"web_components"},"js":{"version":"0.0.10","source":"hosted","description":"js"},"args":{"version":"0.0.0-r.15130","source":"sdk","description":"args"},"unittest":{"version":"0.0.0-r.15130","source":"sdk","description":"unittest"},"html5lib":{"version":"0.2.0","source":"hosted","description":"html5lib"},"logging":{"version":"0.0.0-r.15130","source":"sdk","description":"logging"}}}

pub update seems to work without any problem even missing the lock file, then the file just appears right after the operation with the following content

{"packages":{"web_components":{"version":"0.2.7","source":"hosted","description":"web_components"},"js":{"version":"0.0.10","source":"hosted","description":"js"},"args":{"version":"0.0.0-r.15130","source":"sdk","description":"args"},"unittest":{"version":"0.0.0-r.15130","source":"sdk","description":"unittest"},"html5lib":{"version":"0.2.1","source":"hosted","description":"html5lib"},"logging":{"version":"0.0.0-r.15130","source":"sdk","description":"logging"},"meta":{"version":"0.0.0-r.15130","source":"sdk","description":"meta"}}}

Prompt me if requiring any other kind of information.

@munificent
Copy link
Member Author

pub update seems to work without any problem even missing the lock file, then the file just appears right after the operation with the following content

It's strange that this works but pub install doesn't. Can you do me a favor and delete your lock file and then try pub install again?

Sorry for all the back and forth, but I don't know how to repro this issue here. Thanks!

@DartBot
Copy link

DartBot commented Nov 29, 2012

This comment was originally written by [email protected]


Just did as told, but it's just hanging as before. Although it seems to be only happening on pub install.

@munificent
Copy link
Member Author

OK, thanks. I'll see if I can take a look at this. However, I still don't know how to reproduce it locally so any other information you can give me will help. Do you know if there's anything unusual about your file system, OS, etc.? Any ideas why creating a file might fail?


Added Accepted label.

@DartBot
Copy link

DartBot commented Nov 29, 2012

This comment was originally written by [email protected]


I've also tried under administrative rights, but it didn't solve the issue.
The path "C:\Users\Lele\Desktop\whateverdart" where I'm executing pub install on does not contain any special character, neither does the one containing the pub command "C:\Users\Lele\Documents\miscellaneous\dart\dart-sdk\bin"

Some time ago I've messed up with the language settings on this machine; I don't know whether that might actually be the problem but other SDKs, like the Android one, are perfectly able to write on the filesystem of this pc.
I'll try on the computer at my workplace and see if it also reproduces there.

@DartBot
Copy link

DartBot commented Nov 30, 2012

This comment was originally written by [email protected]


I have exactly the same issue. Creating the lock file manually "solves" it. If there is something I can do to help just give me a ping.

@munificent
Copy link
Member Author

If there is something I can do to help just give me a ping.

As always, precise steps to reproduce the problem on a machine here will help immensely. Right now, I see that this is an issue, but I can't reproduce it myself so I don't know how to go about fixing it.

@DartBot
Copy link

DartBot commented Dec 6, 2012

This comment was originally written by [email protected]


As always, precise steps to reproduce the problem on a machine here will help >>immensely.

  1. Get a machine with Windows 7, x86. Preferable non-English locale.
  2. Download DartEditor 15699
  3. Clear pub cache, if it exists. (At c:\Users\UserName\AppData\Roaming\Pub)
  4. Open command prompt on dart\samples\solar3d
  5. Run pub install

Expect pub working, instead it hangs forever.

  1. Create zero sized pubspec.lock by any means.
  2. Run pub install

Pub has worked, packages installed, pubspec.lock updated.

BTW, what kind of machine you are using to reproduce this bug?

 

@DartBot
Copy link

DartBot commented Dec 6, 2012

This comment was originally written by [email protected]


Sorry. Actually I have had dart of revision 15369 as active version.
On dart of revision 15699 hack with zero sized pubspec.lock does not work anymore.
There is fresh bug.
After step 5 (pub hanging),

  1. Create zero sized pubspec.lock by any means.
  2. Run pub install

Get a stacktrace:

Resolving dependencies...
Downloading vector_math 0.9.1...
Unhandled exception:
Illegal argument(s)
#­0 _StringBase._createFromCodePoints (dart:core-patch:1403:3)
#­1 _StringBase.createFromCharCodes (dart:core-patch:1400:33)
#­2 String.String.fromCharCodes (dart:core-patch:1788:43)
#­3 _StringDecoderBase.decoded (dart:io:6485:12)
#­4 _StringInputStream.read (dart:io:6681:37)
#­5 _NonInteractiveProcess._NonInteractiveProcess.<anonymous closure>.<anony
mous closure> (dart:io-patch:303:38)
#­6 _StringInputStream._onData._onData (dart:io:6727:25)
#­7 _SocketBase._multiplex (dart:io-patch:400:26)
#­8 _SocketBase._sendToEventHandler.<anonymous closure> (dart:io-patch:501:2
0)
#­9 _ReceivePortImpl._handleMessage (dart:isolate-patch:37:92)

@DartBot
Copy link

DartBot commented Dec 6, 2012

This comment was originally written by [email protected]


Filed http://code.google.com/p/dart/issues/detail?id=7180 for this new one.

@munificent
Copy link
Member Author

Thanks for the new bug, that definitely sounds like a different issue.

@munificent
Copy link
Member Author

Anyone who can reproduce this issue, if you'd like to help me track this down could you please:

  1. Download the latest bleeding edge SDK. Go here: http://www.dartlang.org/downloads.html and click "latest continuous build".
  2. Clear out your pub cache and lock file (if you have one).
  3. Run pub --verbose install

That should spew a pile of detailed logs at you. If you can repro the issue, please save those to a fail and attach them to this bug. Thanks!

In the meantime, I'll see if I can reproduce this on my Windows machine here.


Added Started label.

@DartBot
Copy link

DartBot commented Dec 11, 2012

This comment was originally written by [email protected]


Done.
I use solar3d sample again.
My output is short:

c:\dart\samples\solar3d>pub --verbose install
IO : Seeing if file c:\dart\samples\solar3d\pubspec.yaml exists.
IO : File c:\dart\samples\solar3d\pubspec.yaml exists.
IO : Reading text file c:\dart\samples\solar3d\pubspec.yaml.
IO : Read c:\dart\samples\solar3d\pubspec.yaml. Contents:
    | name: solar3d
    | description: 3D Solar System Demo
    | version: 0.0.1
    | author: John McCutchan <[email protected]>
    | homepage: https://github.com/johnmccutchan/solar3d
    | dependencies:
    | vector_math: any
    |
FINE: Loading lockfile.
IO : Reading text file c:\dart\samples\solar3d\pubspec.lock.

On this step process hangs up.

@DartBot
Copy link

DartBot commented Dec 11, 2012

This comment was originally written by @aam


Just reproduced Vadim's issue(on freshly installed Russian Win7). It hangs at the same "Reading text file" step(mangled pseudo-graphics is what the output actually looks like):

===
C:\Users\Александр\Downloads\darteditor-win32-64\dart\samples\solar3d>pub --verb
ose install
IO : Seeing if file C:\Users\╨Р╨╗╨╡╨║╤Б╨░╨╜╨┤╤А\Downloads\darteditor-win32-64\d
art\samples\solar3d\pubspec.yaml exists.
IO : File C:\Users\╨Р╨╗╨╡╨║╤Б╨░╨╜╨┤╤А\Downloads\darteditor-win32-64\dart\sample
s\solar3d\pubspec.yaml exists.
IO : Reading text file C:\Users\╨Р╨╗╨╡╨║╤Б╨░╨╜╨┤╤А\Downloads\darteditor-win32-6
4\dart\samples\solar3d\pubspec.yaml.
IO : Read C:\Users\╨Р╨╗╨╡╨║╤Б╨░╨╜╨┤╤А\Downloads\darteditor-win32-64\dart\sample
s\solar3d\pubspec.yaml. Contents:
    | name: solar3d
    | description: 3D Solar System Demo
    | version: 0.0.1
    | author: John McCutchan <[email protected]>
    | homepage: https://github.com/johnmccutchan/solar3d
    | dependencies:
    | vector_math: any
    |
FINE: Loading lockfile.
IO : Reading text file C:\Users\╨Р╨╗╨╡╨║╤Б╨░╨╜╨┤╤А\Downloads\darteditor-win32-6
4\dart\samples\solar3d\pubspec.lock.
===

@DartBot
Copy link

DartBot commented Dec 11, 2012

This comment was originally written by [email protected]


I suspect that if reading lock file have been guarded by WinApi FileExists function, process would pass on.
Why it started to hang only recently though...

@munificent
Copy link
Member Author

We're still trying to get a machine configured in a way that we can repro this. In the meantime, can any of you try the following and let me know if this helps?

  1. Pull down the latest bleeding edge SDK.
  2. Open dart/dart-sdk/util/pub/entrypoint.dart.
  3. Look for _loadLockFile and replace it with:

  Future<LockFile> _loadLockFile() {
    var lockFilePath = join(root.dir, 'pubspec.lock');

    log.fine("Loading lockfile.");
    return fileExists(lockFilePath).chain((exists) {
      if (!exists) {
        log.fine("No lock file at $lockFilePath, creating empty one.");
        return new Future<LockFile>.immediate(new LockFile.empty());
      }

      return readTextFile(lockFilePath).transform((text) =>
          new LockFile.parse(text, cache.sources));
    });
  }

Try to repro the problem.

This may fix the issue, which would be good, or it may not. Either way, I still don't know why the issue is appearing.

@munificent
Copy link
Member Author

Hi, Mads!

Based on the logging, it looks like this is hanging in a call to:

new File(path).readAsString(Encoding.UTF_8)

If it had proceeded much farther, there would be more log output so I think it's the dart:io call itself that never returns. On all of our machines, this of course does the right thing when the file doesn't exist (it completes to an exception), but that doesn't seem to be the case for the users on this bug. Any idea why that may be?


cc @madsager.

@dgrove
Copy link
Contributor

dgrove commented Dec 11, 2012

Can the logging be broken up so that you know whether it's the new File() or readAsString() that isn't returning?

@munificent munificent added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io labels Dec 11, 2012
@munificent munificent added this to the M2 milestone Dec 11, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io
Projects
None yet
Development

No branches or pull requests

4 participants